home *** CD-ROM | disk | FTP | other *** search
/ Apple Reference & Presen…tion Library 4 (Reseller) / Apple Ref. & Pres. Lib.v4.0.iso / 2-Graphics / Apple Graphics Source / Apple Graphics Source 2.3 / Apple Graphics Source 2.3 / background_2703.txt < prev    next >
Text File  |  1990-03-28  |  104KB  |  3,187 lines

  1. -- background: 2703 from stack: in.3
  2. -- bmap block id: 3276
  3. -- flags: 4000
  4. -- background id: 0
  5. -- name: The Collection
  6. ----- HyperTalk script -----
  7. --SYSTEM MESSAGES-----------------------------------------------------
  8.  
  9. on openBackground
  10.   global firstTimeAGS, artManagement
  11.   if artManagement then admin
  12.   else closeAdmin
  13.   if firstTimeAGS = empty then
  14.     set cursor to watch
  15.     initializeVars
  16.     updateDocuments
  17.     checkDocuments
  18.     put 1 into firstTimeAGS
  19.   end if
  20.   if hilite of bg btn "help" then set hilite of bg btn "help" to false
  21. end openBackground
  22.  
  23. on closeBackground
  24.   changeView "graphics view"
  25. end closeBackground
  26.  
  27. on openCard
  28.   global listScroll, currentView
  29.   setCdNo
  30.   if cantModify of this stack then setView
  31.   if currentView = "lists view" then
  32.     fillInFields
  33.     set scroll of fld "list" to listScroll
  34.   end if
  35.   unlock screen
  36. end openCard
  37.  
  38. on closeCard
  39.   global listScroll
  40.   put the scroll of fld "list" into listScroll
  41.   lock screen
  42.   emptyFields
  43. end closeCard
  44.  
  45. --MESSAGE HANDLERS----------------------------------------------------
  46.  
  47. on selectLine whichLine, whichFld
  48.   --Adapted from a script by Jim Palmer.
  49.   --whichLine is a wholeNumber and whichFld is the short name of a fld.
  50.   if whichLine = empty OR whichFld = empty then exit selectLine
  51.   put line whichLine of fld whichFld into theText
  52.   if theText <> empty then
  53.     put (number of chars of line 1 to whichLine of fld whichFld) + 1 into endChar
  54.     select char (endChar - length (theText)) to endChar of fld whichFld
  55.     wait 5
  56.   end if
  57. end selectLine
  58.  
  59. on updateDocuments newPaths
  60.   --Updates the global documents. The newPaths parameter is optional,
  61.   --and is paths that need to be added to the Documents card in the
  62.   --Home stack.
  63.   if cantModify of this stack then exit updateDocuments
  64.   global documents
  65.   lock screen
  66.   set lockRecent to true
  67.   set lockMessages to true
  68.   push cd
  69.   go home
  70.   go cd "documents"
  71.   if the result <> empty then
  72.     --the Documents card in the Home stack doesn't appear to exist.
  73.     dialogIt "The stack is having trouble locating the" && "Documents card in the Home stack. Consequently, the stack" && "may have trouble finding the original graphics."
  74.     pop cd
  75.     exit updateDocuments
  76.   else
  77.     --the Documents card in the Home stack was found.
  78.     if newPaths <> empty then put return & newPaths after fld "paths"
  79.     put fld "paths" into documents
  80.   end if
  81.   put fld "paths" into documents
  82.   pop cd
  83. end updateDocuments
  84.  
  85. on checkDocuments newPaths
  86.   --Checks the document paths in this stack against the global
  87.   --documents. Discrepencies are put into newPaths and sent to the
  88.   --handler updateDocuments to be added to the Documents card in the
  89.   --Home stack. NewPaths is optional, and allows you to add paths to
  90.   --the storage in this stack.
  91.   global documents
  92.   put cd fld "paths to graphics" of cd "title card" into existPaths
  93.   if newPaths <> empty then
  94.     repeat with N = 1 to the number of lines in newPaths
  95.       if not isWithin(line N of newPaths,existPaths) then
  96.         put return & line N of newPaths after existPaths
  97.       end if
  98.     end repeat
  99.     put existPaths into cd fld "paths to graphics" of cd "title card"
  100.   end if
  101.   put empty into newPaths
  102.   repeat with i = 1 to the number of lines in existPaths
  103.     if not isWithin(line i of existPaths,documents) then
  104.       put return & line i of existPaths after newPaths
  105.     end if
  106.   end repeat
  107.   if newPaths <> empty then updateDocuments newPaths
  108. end checkDocuments
  109.  
  110. on deleteEntryVisible boolean
  111.   if boolean then
  112.     put "Click an entry in the list to delete it." into fld "directions to delete"
  113.   else
  114.     set hilite of bg btn "done" to true
  115.     set hilite of bg btn "done" to false
  116.   end if
  117.   lock screen
  118.   set visible of fld "directions to delete" to boolean
  119.   set visible of bg btn "done" to boolean
  120.   unlock screen
  121.   if not boolean then put empty into fld "directions to delete"
  122. end deleteEntryVisible
  123.  
  124. on showNew newGraphics,text
  125.   put sortContainer(newGraphics) into theList
  126.   get listDialog(theList,13,text,false,"OK")
  127. end showNew
  128.  
  129. on showExisting theList
  130.   put "These cards already existed and weren't added." into text
  131.   get listDialog(theList,13,text,false,"OK")
  132. end showExisting
  133.  
  134. on showHelp boolean
  135.   lock screen
  136.   set the showPict of this card to not(boolean)
  137.   set the visible of fld "banner" to boolean
  138.   set the visible of bg btn "Help Section" to boolean
  139.   set the visible of bg btn "Help Close" to boolean
  140.   set the hilite of bg btn "Help" to boolean
  141.   if not boolean then put empty into fld "banner"
  142.   if boolean then unlock screen with zoom open
  143.   else unlock screen with zoom close
  144. end showHelp
  145.  
  146. on setView
  147.   global currentView
  148.   if currentView = "lists view" then
  149.     send mouseUp to bg btn "lists view"
  150.     showListName
  151.   else send mouseUp to bg btn "graphics view"
  152. end setView
  153.  
  154. on toggleLockScreen
  155.   unlock screen
  156.   lock screen
  157.   unlock screen
  158. end toggleLockScreen
  159.  
  160. on removeCdPict
  161.   put the tool into toolStatus
  162.   choose select tool
  163.   doMenu "select all"
  164.   doMenu "clear picture"
  165.   choose toolStatus
  166. end removeCdPict
  167.  
  168. on showProgress whichText, whichPercent
  169.   put whichText && "(" & whichPercent & "% Complete" & ")"
  170. end showProgress
  171.  
  172. on hideProgress
  173.   put empty
  174.   hide msg
  175. end hideProgress
  176.  
  177. on changeView whichView
  178.   global currentView
  179.   set cursor to watch
  180.   lock screen
  181.   if whichView = "lists view" then put true into boolean
  182.   else put false into boolean
  183.   setBtnHilites boolean
  184.  
  185.   -- ABOUT THIS GRAPHIC view
  186.   set visible of bg btn "description:" to not boolean
  187.   set visible of fld "description field" to not boolean
  188.   set visible of bg btn "format:" to not boolean
  189.   set visible of fld "format field" to not boolean
  190.   set visible of bg btn "file name:" to not boolean
  191.   set visible of fld "file name field" to not boolean
  192.   set visible of bg btn "keywords:" to not boolean
  193.   set visible of fld "keywords field" to not boolean
  194.   set visible of bg btn "appears in books:" to not boolean
  195.   set visible of fld "appears in books field" to not boolean
  196.   set visible of bg btn "info blanket" to not boolean
  197.  
  198.   -- LISTS view
  199.   set visible of bg btn id 353 to boolean
  200.   --the name of the open list
  201.   set visible of fld "list heading field" to boolean
  202.   set visible of fld "list" to boolean
  203.   set visible of bg btn "new list" to boolean
  204.   set visible of bg btn "open list‚Ķ" to boolean
  205.   set visible of bg btn "save" to boolean
  206.   set visible of bg btn "delete list‚Ķ" to boolean
  207.   set visible of bg btn "print list‚Ķ" to boolean
  208.   set visible of bg btn "add this graphic" to boolean
  209.   set visible of bg btn "delete #‚Ķ" to boolean
  210.   deleteEntryVisible false
  211.   if boolean then
  212.     showListName
  213.     fillInFields
  214.     put "lists view" into currentView
  215.     put "iris close" into theEffect
  216.   else
  217.     put "graphics view" into currentView
  218.     put "iris open" into theEffect
  219.   end if
  220.   unlock screen with visual effect theEffect
  221. end changeView
  222.  
  223. on setBtnHilites boolean
  224.   set the hilite of bg btn "lists view" to boolean
  225.   set the hilite of bg btn "graphics view" to not(boolean)
  226. end setBtnHilites
  227.  
  228. on controlKey whichKey
  229.   --1 = the letter A in ASCII.
  230.   --11 = the letter K in ASCII.
  231.   if whichKey = "1" then send mouseUp to bg btn "add this graphic"
  232.   else if whichKey = "11" then addToIndex "keyword", "keyword index"
  233.   else pass controlKey
  234. end controlKey
  235.  
  236. on initializeVars
  237.   global listScroll,taggedList,changesToList,activeListName, ticksToWait,listStack,lastWindow,displayOrPrint,entrySuffix, entryPrefix,tryServers
  238.   put false into changesToList
  239.   put 0 into listScroll
  240.   put empty into taggedList
  241.   put "Untitled" into activeListName
  242.   put "     | " into entryPrefix
  243.   put ". | " into entrySuffix
  244.   put cd fld "browsing speed" of cd "title card" into ticksToWait
  245.   if ticksToWait = empty then put 0 into ticksToWait
  246.   put "Graphics Database Lists" into listStack
  247.   put "5,21,484,291" into lastWindow
  248.   put "1" into displayOrPrint
  249.   if cantModify of this stack then put false into tryServers
  250.   else put true into tryServers
  251. end initializeVars
  252.  
  253. on stopBtnStatus boolean
  254.   set visible of bg btn "click and hold to stop" to boolean
  255. end stopBtnStatus
  256.  
  257. on adminElements boolean
  258.   set cursor to watch
  259.   lock screen
  260.   buildMenus
  261.   put developerBtns() into theBtns
  262.   if boolean then
  263.     put "barn door open" into theEffect
  264.     repeat with N = 1 to the number of items in theBtns
  265.       set hilite of bg btn (item N of theBtns) to false
  266.     end repeat
  267.   else put "barn door close" into theEffect
  268.   repeat with N = 1 to the number of items in theBtns
  269.     set visible of bg btn (item N of theBtns) to boolean
  270.   end repeat
  271.   if boolean AND the loc of cd window = "0,0" then hide menubar
  272.   else show menubar
  273.   unlock screen with theEffect
  274. end adminElements
  275.  
  276. on emptyFields
  277.   put empty into fld "list heading field"
  278.   put empty into fld "List"
  279. end emptyFields
  280.  
  281. on fillInFields
  282.   global taggedList, entryPrefix
  283.   put entryPrefix & "Description" & return & entryPrefix & "File Name" into fld "list heading field"
  284.   put "#" into char 3 of fld "list heading field"
  285.   put taggedList into fld "List"
  286. end fillInFields
  287.  
  288. on setCdNo
  289.   put bgCard() into bgCard
  290.   set the name of bg btn id 216 to "Card" && bgCard && "of" && (the number of cds in this bg)
  291. end setCdNo
  292.  
  293. on lookForUnindexedEPN
  294.   --this handler locates EPNs that aren't part of the book index.
  295.   --it's not called from any other handler.
  296.   put readIndex("book index") into bookIndex
  297.   lock screen
  298.   set lockMessages to true
  299.   set lockRecent to true
  300.   repeat the number of cds in this bg
  301.     repeat with i = 1 to the number of lines in fld "appears in books field"
  302.       if line i of fld "appears in books field" = empty then exit repeat
  303.       if line i of fld "appears in books field" = return then
  304.         exit repeat
  305.       end if
  306.       if isFigNo(line i of fld "appears in books field") then
  307.         exit repeat
  308.       end if
  309.       if not isWithin(line i of fld "appears in books field",bookIndex)
  310.       then
  311.       ask "" with i && (line i of fld "appears in books field")
  312.       exit to hypercard
  313.     end if
  314.   end repeat
  315.   go next cd of this bg
  316.   put the number of this cd
  317. end repeat
  318. end lookForUnindexedEPN
  319.  
  320. --GRAPHICS scripts--------------------------------------------------
  321.  
  322. on displayPicture
  323.   global lastWindow, displayOrPrint, tryServers
  324.   set cursor to busy
  325.   show menuBar
  326.   put item 1 of lastWindow into left
  327.   put item 2 of lastWindow into top
  328.   put item 3 of lastWindow into right
  329.   put item 4 of lastWindow into bottom
  330.   if tryServers then mountFileServer
  331.   lock screen
  332.   set lockRecent to true
  333.   set lockMessages to true
  334.   if cantModify of this stack then
  335.     put buildPicturePath() into fileName
  336.   else put fld "file name field" into fileName
  337.   DispPICT fileName,displayOrPrint,1,left,top,right,bottom,0,0,0
  338.   put the result into XCMDanswer
  339.   -- the result is either the coordinates of the graphic window when it was
  340.   -- closed or an error message
  341.   if xcmdAnswer contains "error" then
  342.     dispPictError "displayPicture",xcmdAnswer,fileName
  343.   else put xcmdAnswer into lastWindow
  344.   openCard
  345. end displayPicture
  346.  
  347. on displayTiny whichPath
  348.   global tryServers
  349.   set cursor to watch
  350.   if tryServers then mountFileServer
  351.   if whichPath = empty then put fld "file name field" into whichPath
  352.   set lockMessages to true
  353.   set lockRecent to true
  354.   tinyPICT whichPath,200,200
  355.   put the result into xcmdAnswer
  356.   if xcmdAnswer contains "error" then
  357.     dispPictError "displayTiny",xcmdAnswer,whichPath
  358.     openCard
  359.     return xcmdAnswer
  360.     exit displayTiny
  361.   end if
  362.   if cardPictureExists() then
  363.     dialogIt "Replace the existing thumbnail for this card?","No,Yes"
  364.     if the result = "No" then exit displayTiny
  365.   end if
  366.   lock screen
  367.   choose select tool
  368.   drag from 0,0 to 300,300
  369.   doMenu "Clear Picture"
  370.   type "V" with commandKey
  371.   drag from 25,25 to 50,90
  372.   doMenu "select"
  373.   -- to get rid of opaque paint
  374.   choose browse tool
  375.   unlock screen
  376. end displayTiny
  377.  
  378. on dispPictError initialHandler, xcmdAnswer, whichFile
  379.   if xcmdAnswer contains "File not found" then
  380.     addThisPath initialHandler
  381.   end if
  382.   if xcmdAnswer contains "Not enough memory" then
  383.     dialogIt "There is not enough memory to open the file" &"e& whichFile "e& "."
  384.   end if
  385.   if xcmdAnswer contains "File could not be opened" then
  386.     -- this file is not in a format we can handle
  387.     dialogIt "The file" &"e& whichFile "e&& "is stored in a file format this stack doesn't support." && "The file can't be opened."
  388.   end if
  389.   if xcmdAnswer contains "user cancelled operation" then
  390.     --the user hit command-period to cancel
  391.   end if
  392. end dispPICTerror
  393.  
  394. on addThisPath initialHandler
  395.   put line 1 of fld "file name field" into graphicID
  396.   if graphicID = empty then
  397.     dialogIt "Since the File Name field is empty, the original" && "file could not be accessed."
  398.     exit addThisPath
  399.   end if
  400.   put FileName("","Where is the file" && quote & graphicID & quote & "?") into longName
  401.   if longName = empty then exit addThisPath
  402.   put getShortName(longName) into fileName
  403.   put getPath(longName) into folderPath
  404.   updateDocuments folderPath
  405.   put initialHandler &"e& fileName "e into executeThis
  406.   do executeThis
  407. end addThisPath
  408.  
  409. on copyThumbnail
  410.   put the userLevel into userStatus
  411.   if the userLevel < 3 then set the userLevel to 3
  412.   put the tool into toolStatus
  413.   choose select tool
  414.   --or any paint tool
  415.   doMenu "select"
  416.   type "C" with commandKey
  417.   choose toolStatus
  418.   set the userLevel to userStatus
  419. end copyThumbnail
  420.  
  421. on mountFileServer
  422.   global tryServers
  423.   -- thanks to Landon Dyer for the Mount XCMD
  424.   put listVol() into volumeNames
  425.   if not isWithin("Graphics Source",volumeNames) then
  426.     Mount "Apple Graphics", "Apple Graphics Source", "Graphics Source"
  427.     if the result <> empty then put false into tryServers
  428.     --the parameters are zone name, server name, volume name
  429.     -- if the volume wasn't found, Mount puts a message into the result
  430.   end if
  431. end mountFileServer
  432.  
  433. --FIND scripts------------------------------------------------------
  434.  
  435. on findKWSetup whichText
  436.   put "The keyword "& quote & whichText & quote & " is not assigned to any graphic." into noneFound
  437.   put "You have browsed through all graphics assigned the keyword " & quote & whichText & quote &"." into allFound
  438.   lookFor whichText,"keywords field",noneFound,allFound,"whole"
  439. end findKWSetup
  440.  
  441. on findBookSetup whichText
  442.   put "The book "& quote & whichText & quote & " is not assigned to any graphic." into noneFound
  443.   put "You have browsed through all graphics from the book " & quote & whichText & quote &"." into allFound
  444.   lookFor whichText, "appears in books field",noneFound,allFound,"whole"
  445. end findBookSetup
  446.  
  447. on findNameSetup whichText
  448.   put "The description "& quote & whichText & quote & " is not assigned to any graphic." into noneFound
  449.   put "You have browsed through all graphics with the description" &"e& whichText "e& "." into allFound
  450.   lookFor whichText, "description field", noneFound, allFound, "string"
  451. end findNameSetup
  452.  
  453. on findFormatSetup whichText
  454.   put "There are no graphics in the format " & quote & whichText & quote & "." into noneFound
  455.   put "You have browsed through all graphics in the format " & quote & whichText & quote &"." into allFound
  456.   lookFor whichText, "format field", noneFound, allFound, "whole"
  457. end findFormatSetup
  458.  
  459. on lookFor whichText, whichFld, noneFound, allFound, searchType
  460.   global ticksToWait
  461.   put 1 into counter
  462.   set cursor to watch
  463.   lock screen
  464.   put empty into card1
  465.   put empty into card2
  466.   repeat until the mouseClick
  467.     if the mouse is up then find whole whichText in fld whichFld
  468.     else exit repeat
  469.     if the foundChunk = empty then
  470.       --The text wasn't found in the specified field, so exit.
  471.       unlock screen
  472.       stopBtnStatus false
  473.       dialogIt noneFound
  474.       exit lookFor
  475.     end if
  476.     put word 2 of the foundLine into thisLine
  477.     if searchType = "whole" then
  478.       if whichText <> line thisLine of fld whichFld then
  479.         --There was a find, but not an exact match, so look again.
  480.         next repeat
  481.       end if
  482.     else if whichFld = "description field" AND thisLine <> 1 then
  483.       next repeat
  484.     end if
  485.     --If it got this far, then there was an exact match.
  486.     if counter = 1 then
  487.       --This is the first time through.
  488.       put 2 into counter
  489.       put the id of this cd into card1
  490.     else
  491.       put the id of this cd into card2
  492.       stopBtnStatus true
  493.     end if
  494.     unlock screen with visual effect wipe left
  495.     if searchType = "whole" then
  496.       selectLine thisLine, last word of the foundLine
  497.     else select the foundChunk
  498.     put (the ticks + ticksToWait) into stopTicks
  499.     repeat until stopTicks < (the ticks)
  500.       if the mouse is down then
  501.         --If the mouse is down then the user wants to stop.
  502.         stopBtnStatus false
  503.         exit lookFor
  504.       end if
  505.     end repeat
  506.     if card1 = card2 then
  507.       --You're at the same place you started, which means you've gone
  508.       --through all of the cards, so stop.
  509.       stopBtnStatus false
  510.       dialogIt allFound
  511.       exit repeat
  512.     end if
  513.     lock screen
  514.   end repeat
  515.   stopBtnStatus false
  516. end lookFor
  517.  
  518. --INDEX scripts------------------------------------------------------
  519.  
  520. --In the scripts that manipulate the indexes:
  521. --indexField is the field in this background that stores the text.
  522. --writeField is the name of the field on the card "title card" which
  523. --stores the needed index.
  524. --indexType is the class of keyword, e.g., keyword, book,
  525. --in singular form
  526.  
  527. on buildIndex indexField, writeField
  528.   if the lockMessages = false then
  529.     answer "Build the" && writeField && "?" with "Cancel" or "OK"
  530.     if it is "Cancel" then exit buildIndex
  531.   end if
  532.   lock screen
  533.   put empty into thisIndex
  534.   set lockMessages to true
  535.   set lockRecent to true
  536.   set cursor to watch
  537.   push cd
  538.   go cd 1 of this bg
  539.   put "Building the" && writeField  into status
  540.   repeat with j = 1 to the number of cds in this bg
  541.     showProgress status,round(j/(the number of cds in this bg)*100)
  542.     repeat with i = 1 to (the number of lines in fld indexField)
  543.       if line i of fld indexField is empty then next repeat
  544.       if not isWithin(line i of fld indexField,thisIndex) then
  545.         put line i of fld indexField & return after thisIndex
  546.       end if
  547.     end repeat
  548.     go next cd of this bg
  549.   end repeat
  550.   writeIndex sortContainer(thisIndex), writeField
  551.   pop cd
  552.   hideProgress
  553. end buildIndex
  554.  
  555. on addToIndex indexType, writeField
  556.   toggleLockScreen
  557.   ask "Enter the name of the new" && indexType & ":"
  558.   if it is empty then exit addToIndex
  559.   else put it into addThis
  560.   set cursor to busy
  561.   put readIndex(writeField) into thisIndex
  562.   if isWithin(addThis, thisIndex) then
  563.     dialogIt "The" && indexType && quote & addThis & quote && "already exists in the" && writeField & "."
  564.   else
  565.     put return & addThis & return after thisIndex
  566.     put sortContainer(thisIndex) into thisIndex
  567.     writeIndex thisIndex, writeField
  568.   end if
  569. end addToIndex
  570.  
  571. on deleteFromIndex indexField, writeField
  572.   global DialogButton
  573.   set cursor to watch
  574.   put "Delete what from the" && writeField & ":" into text
  575.   put readIndex(writeField) into theIndex
  576.   get listDialog(theIndex,13,text,true,"Delete,Cancel")
  577.   put it into theAnswer
  578.   if DialogButton = "cancel" then exit deleteFromIndex
  579.   put the long name of this cd into returnHere
  580.   lock screen
  581.   repeat with i = (the number of lines in theAnswer) down to 1
  582.     --for each term to be deleted
  583.     put true into allInstancesDeleted
  584.     go cd 1 of bg "the collection"
  585.     put empty into alreadySeen
  586.     repeat
  587.       --for each instance of that term to be deleted.
  588.       set cursor to watch
  589.       put line i of theAnswer into whichText
  590.       find whole whichText in fld indexField
  591.       if the foundChunk = empty then exit repeat
  592.       if isWithin(the short name of this cd,alreadySeen) then
  593.         --we've already been to this cd
  594.         exit repeat
  595.       end if
  596.       setCdNo
  597.       put the short name of this cd & return after alreadySeen
  598.       put word 2 of the foundLine into thisLine
  599.       if whichText <> line thisLine of fld indexField then
  600.         --this line is only part of the phrase we're looking for so
  601.         next repeat
  602.       end if
  603.       unlock screen
  604.       selectLine thisLine, indexField
  605.       if the optionKey is up then
  606.         dialogIt "Delete" && quote & whichText & quote && "from the" && indexField && "of this card?","Stop,No,Delete"
  607.         put the result into decision
  608.         unlock screen
  609.         if decision = "Stop" then exit deleteFromIndex
  610.         if decision = "No" then put false into allInstancesDeleted
  611.         if decision <> "Delete" then next repeat
  612.       end if
  613.       delete line thisLine of fld indexField
  614.       lock screen
  615.     end repeat
  616.     if allInstancesDeleted then
  617.       --delete the term from the index
  618.       put getLine(whichText,theIndex) into thisLine
  619.       if thisLine <> empty then  delete line thisLine of theIndex
  620.       writeIndex theIndex,writeField
  621.     end if
  622.   end repeat
  623.   go returnHere
  624. end deleteFromIndex
  625.  
  626. on writeIndex thisIndex,writeField
  627.   put thisIndex into cd fld writeField of cd "title card"
  628.   set the scroll of cd fld writeField of cd "title card" to 0
  629. end writeIndex
  630.  
  631. on exportIndex writeField,fileName
  632.   open file fileName
  633.   put readIndex(writeField) into keywordIndex
  634.   write keywordIndex to file fileName
  635.   close file fileName
  636.   dialogIt "The file" && fileName && "was created."
  637. end exportIndex
  638.  
  639. on assignToCard indexType,indexField,writeField
  640.   global DialogButton
  641.   set cursor to watch
  642.   put "Assign what" && indexType & "(s) to this card:" into text
  643.   put readIndex(writeField) into theList
  644.   get listDialog(theList,13,text,true,"Assign,New^,Cancel")
  645.   put it into assignThis
  646.   if DialogButton = "cancel" then exit assignToCard else
  647.   if DialogButton = "new" then
  648.     addToIndex indexType, writeField
  649.     assignToCard indexType,indexField,writeField
  650.     exit assignToCard
  651.   end if
  652. end if
  653. repeat with i = 1 to the number of lines in assignThis
  654.   set cursor to busy
  655.   if isWithin(line i of assignThis,fld indexField) then
  656.     dialogIt "The" && indexType && quote & line i of assignThis & quote && "is already assigned to this graphic."
  657.   else
  658.     -- the term is not already assigned
  659.     put fld indexField & return & line i of assignThis into newContents
  660.     put alphaSort(newContents) into fld indexField
  661.   end if
  662. end repeat
  663. end assignToCard
  664.  
  665. on deleteFromCard indexType, indexField
  666.   global DialogButton
  667.   set cursor to watch
  668.   put "Delete what from the" && indexType & "s" && "field of this card?" into text
  669.   put fld indexField into theList
  670.   get listDialog(theList,13,text,true,"Delete,Cancel")
  671.   put it into theAnswer
  672.   if DialogButton = "cancel" then exit deleteFromCard
  673.   repeat with i = (the number of lines in theAnswer) down to 1
  674.     set cursor to busy
  675.     put getLine(line i of theAnswer,fld indexField) into thisLine
  676.     if thisLine <> 0 then delete line thisLine of fld indexField
  677.   end repeat
  678.   set scroll of fld indexField to 0
  679. end deleteFromCard
  680.  
  681. --FUNCTIONS-----------------------------------------------------------
  682.  
  683. function bgCard
  684. return (the number of this cd - bgStart()) + 1
  685. end bgCard
  686.  
  687. function bgStart
  688. return the number of cd 1 of this bg
  689. end bgStart
  690.  
  691. function menuPop whichObject
  692. if whichObject is empty then put the target into whichObject
  693. set the hilite of whichObject to true
  694. put the bottom of whichObject into menuT
  695. put the left of whichObject + 1 into menuL
  696. return (menuT & ", " & menuL)
  697. end menuPop
  698.  
  699. function isWithin thisText, container
  700. --returns true of thisText is a complete line in the given container.
  701. if line 1 of container = thisText OR container contains return & thisText & return OR thisText = last line of container then return true
  702. return false
  703. end isWithin
  704.  
  705. function getLine whichText,container
  706. --Where whichText is any text string.
  707. --Returns the line number of the given text in the given container.
  708. --Returns empty if an entire line in the container does not equal
  709. --whichText.
  710. --Note that OFFSET alone work by itself because you're looking for
  711. --an entire line, not just a subset.
  712. if whichText = line 1 of container then return 1
  713. put offset(return & whichText & return,container) into theChars
  714. if theChars <> 0 then
  715.   return (the number of lines in char 1 to theChars of container) + 1
  716. end if
  717. if whichText = last line of container then
  718.   return (the number of lines in container)
  719. end if
  720. return empty
  721. end getLine
  722.  
  723. function developerBtns
  724. return "menu blanket,catalog,indexes,management,card"
  725. end developerBtns
  726.  
  727. function buildPicturePath
  728. --Remove this and calling handlers from the toolkit.
  729. put bg fld "file name field" into fileName
  730. put the long name of this stack into longName
  731. delete char 1 to 7 of longName
  732. delete last char of longName
  733. put getPath(longName) into longName
  734. put "other files:*graphic files:" after longName
  735. return longName & char 1 of fileName & "aaa-" & char 1 of fileName & "zzz:" & fileName
  736. end buildPicturePath
  737.  
  738. function clickLine whichField
  739. --returns the number of the line clicked.
  740. --first, determine how many lines are hidden above
  741. put (the scroll of whichField / textHeight of whichField) into linesAbove
  742. -- add that number to the relative position clicked
  743. return round(linesAbove + lineClicked(whichField))
  744. end clickLine
  745.  
  746. function lineClicked whichField
  747. return ((the mouseV - item 2 of the rect of whichField - 4) div the textheight of whichField) + 1
  748. end lineClicked
  749.  
  750. function cardPictureExists
  751. --returns true if a card picture exists
  752. put the userLevel into userStatus
  753. if the userLevel < 3 then set the userLevel to 3
  754. put the tool into toolStatus
  755. choose select tool
  756. doMenu "select"
  757. if the tool = "lasso tool" then
  758.   --a card picture does exist
  759.   put true into thisText
  760. else
  761.   --no card picture exists
  762.   put false into thisText
  763. end if
  764. choose toolStatus
  765. set the userLevel to userStatus
  766. return thisText
  767. end cardPictureExists
  768.  
  769. function readIndex writeField
  770. return cd fld writeField of cd "title card"
  771. end readIndex
  772.  
  773. function isEPN whichContainer
  774. if char 1 of whichContainer is in "0123456789" OR (char 1 to 2 of whichContainer = "pX") OR (char 1 to 2 of whichContainer = "pM") OR (char 1 to 3 of whichContainer = "k2s") OR (char 1 to 3 of whichContainer = "pGE") OR (char 1 to 3 of whichContainer = "kmb") OR (char 1 to 4 of whichContainer = "APDA") OR (char 1 to 5 of whichContainer = "m5116") then return true
  775. return false
  776. end isEPN
  777.  
  778. function isFigNo whichContainer
  779. if char 1 to 3 of whichContainer = "fig" OR char 1 to 2 of whichContainer = "pg" OR char 1 to 3 of whichContainer = "pge" OR char 1 to 5 of whichContainer = "panel" then return true
  780. return false
  781. end isFigNo
  782.  
  783. function linesVisible whichFld
  784. --returns the number of lines that are visible in a field.
  785. return round(height of whichFld/the textHeight of whichFld)
  786. end linesVisible
  787.  
  788. function beginEntryLine entryNumber
  789. --this function is used by the Add This Graphic button and the
  790. --Remove # button.
  791. if entryNumber < 10 then return space & space
  792. if entryNumber < 100 then return space
  793. if entryNumber < 1000 then return empty
  794. end beginEntryLine
  795.  
  796. function isEvenNumber whatString
  797. --returns true if the given string is an even number.
  798. if not positiveWholeNumber(whatString) then return false
  799. if whatString mod 2 = 0 then return true
  800. return false
  801. end isEvenNumber
  802.  
  803.  
  804.  
  805. -- part 391 (button)
  806. -- low flags: 80
  807. -- high flags: 0001
  808. -- rect: left=8 top=8 right=27 bottom=506
  809. -- title width / last selected line: 0
  810. -- icon id / first selected line: 0 / 0
  811. -- text alignment: 1
  812. -- font id: 0
  813. -- text size: 12
  814. -- style flags: 0
  815. -- line height: 16
  816. -- part name: Menu blanket
  817.  
  818.  
  819. -- part 374 (button)
  820. -- low flags: 00
  821. -- high flags: 0002
  822. -- rect: left=240 top=50 right=337 bottom=505
  823. -- title width / last selected line: 0
  824. -- icon id / first selected line: 0 / 0
  825. -- text alignment: 1
  826. -- font id: 200
  827. -- text size: 14
  828. -- style flags: 0
  829. -- line height: 18
  830. -- part name: Info Blanket
  831.  
  832.  
  833. -- part 371 (field)
  834. -- low flags: 81
  835. -- high flags: 0007
  836. -- rect: left=247 top=104 right=251 bottom=498
  837. -- title width / last selected line: 0
  838. -- icon id / first selected line: 0 / 0
  839. -- text alignment: 0
  840. -- font id: 4
  841. -- text size: 9
  842. -- style flags: 0
  843. -- line height: 12
  844. -- part name: List
  845. ----- HyperTalk script -----
  846. on mouseUp
  847.   global listScroll, entryPrefix
  848.   set cursor to busy
  849.   put clickLine(the name of me) into whichLine
  850.   selectLine whichLine, "list"
  851.   lock screen
  852.   put line whichLine of fld "list" into findThis
  853.   if findThis is empty then exit mouseUp
  854.   if (whichLine/2) = trunc(whichLine/2) then
  855.     -- user selected a file name
  856.     put line whichLine of fld "list" into uniqueNumber
  857.   else
  858.     -- user selected a name
  859.     put line (whichLine+1) of fld "list" into uniqueNumber
  860.   end if
  861.   -- get rid of extra characters
  862.   delete char 1 to (the number of chars in entryPrefix) of uniqueNumber
  863.   find whole uniqueNumber in fld "file name field"
  864.   if the foundText is empty then
  865.     dialogIt "The file name " & quote & uniqueNumber & quote && "is not assigned to any graphic."
  866.     exit mouseUp
  867.   end if
  868.   set scroll of fld "list" to listScroll
  869.   unlock screen with visual effect wipe left
  870. end mouseUp
  871.  
  872.  
  873. -- part 359 (button)
  874. -- low flags: 00
  875. -- high flags: 4006
  876. -- rect: left=248 top=29 right=49 bottom=411
  877. -- title width / last selected line: 0
  878. -- icon id / first selected line: 17764 / 17764
  879. -- text alignment: 1
  880. -- font id: 200
  881. -- text size: 14
  882. -- style flags: 0
  883. -- line height: 18
  884. -- part name: Graphics View
  885. ----- HyperTalk script -----
  886. on mouseUp
  887.   changeView "graphics view"
  888. end mouseUp
  889.  
  890.  
  891. -- part 293 (button)
  892. -- low flags: 00
  893. -- high flags: 0006
  894. -- rect: left=419 top=29 right=49 bottom=504
  895. -- title width / last selected line: 0
  896. -- icon id / first selected line: 17764 / 17764
  897. -- text alignment: 1
  898. -- font id: 200
  899. -- text size: 12
  900. -- style flags: 0
  901. -- line height: 16
  902. -- part name: Lists View
  903. ----- HyperTalk script -----
  904. on mouseUp
  905.   changeView "lists view"
  906. end mouseUp
  907.  
  908.  
  909. -- part 216 (button)
  910. -- low flags: 00
  911. -- high flags: 8001
  912. -- rect: left=59 top=314 right=334 bottom=181
  913. -- title width / last selected line: 0
  914. -- icon id / first selected line: 0 / 0
  915. -- text alignment: 1
  916. -- font id: 200
  917. -- text size: 12
  918. -- style flags: 0
  919. -- line height: 16
  920. -- part name: Card 1 of 2013
  921. ----- HyperTalk script -----
  922. on mouseUp
  923.   send findCdNumber to bg btn "find‚Ķ"
  924. end mouseUp
  925.  
  926.  
  927.  
  928. -- part 12 (button)
  929. -- low flags: 00
  930. -- high flags: 0000
  931. -- rect: left=26 top=313 right=335 bottom=44
  932. -- title width / last selected line: 0
  933. -- icon id / first selected line: 23716 / 23716
  934. -- text alignment: 1
  935. -- font id: 200
  936. -- text size: 10
  937. -- style flags: 0
  938. -- line height: 13
  939. -- part name: Prev
  940. ----- HyperTalk script -----
  941. on mouseDown
  942.   global ticksToWait
  943.   if the commandKey is down then
  944.     send setBrowseSpeed to bg btn "management"
  945.     exit mouseDown
  946.   end if
  947.   set hilite of me to true
  948.   go prev cd of this bg
  949.   repeat while the mouse is down
  950.     put (the ticks + ticksToWait) into stopTicks
  951.     repeat until stopTicks < (the ticks)
  952.       if the mouse is up then
  953.         set hilite of me to false
  954.         exit mouseDown
  955.       end if
  956.     end repeat
  957.     go prev cd of this bg
  958.   end repeat
  959.   set hilite of me to false
  960. end mouseDown
  961.  
  962.  
  963. -- part 29 (field)
  964. -- low flags: 01
  965. -- high flags: 0007
  966. -- rect: left=244 top=124 right=218 bottom=501
  967. -- title width / last selected line: 0
  968. -- icon id / first selected line: 0 / 0
  969. -- text alignment: 0
  970. -- font id: 200
  971. -- text size: 10
  972. -- style flags: 0
  973. -- line height: 13
  974. -- part name: Keywords field
  975. ----- HyperTalk script -----
  976. on mouseUp
  977.   put line clickLine(the name of me) of me into whichText
  978.   if whichText is empty then exit mouseUp
  979.   set cursor to watch
  980.   findKWSetup whichText
  981. end mouseUp
  982.  
  983.  
  984. -- part 84 (button)
  985. -- low flags: 00
  986. -- high flags: A000
  987. -- rect: left=239 top=106 right=124 bottom=298
  988. -- title width / last selected line: 0
  989. -- icon id / first selected line: 0 / 0
  990. -- text alignment: 0
  991. -- font id: 200
  992. -- text size: 10
  993. -- style flags: 0
  994. -- line height: 13
  995. -- part name: Keywords:
  996. ----- HyperTalk script -----
  997. on mouseUp
  998.   send findKW to bg btn "find‚Ķ"
  999. end mouseUp
  1000.  
  1001.  
  1002.  
  1003. -- part 85 (button)
  1004. -- low flags: 00
  1005. -- high flags: A000
  1006. -- rect: left=239 top=84 right=99 bottom=302
  1007. -- title width / last selected line: 0
  1008. -- icon id / first selected line: 0 / 0
  1009. -- text alignment: 0
  1010. -- font id: 200
  1011. -- text size: 10
  1012. -- style flags: 0
  1013. -- line height: 13
  1014. -- part name: File Name:
  1015. ----- HyperTalk script -----
  1016. on mouseUp
  1017.   send findID to bg btn "find‚Ķ"
  1018. end mouseUp
  1019.  
  1020.  
  1021.  
  1022. -- part 93 (button)
  1023. -- low flags: 00
  1024. -- high flags: A000
  1025. -- rect: left=411 top=84 right=99 bottom=458
  1026. -- title width / last selected line: 0
  1027. -- icon id / first selected line: 0 / 0
  1028. -- text alignment: 0
  1029. -- font id: 200
  1030. -- text size: 10
  1031. -- style flags: 0
  1032. -- line height: 13
  1033. -- part name: Format:
  1034. ----- HyperTalk script -----
  1035. on mouseUp
  1036.   send findFormat to bg btn "find‚Ķ"
  1037. end mouseUp
  1038.  
  1039.  
  1040.  
  1041. -- part 94 (field)
  1042. -- low flags: 01
  1043. -- high flags: 0002
  1044. -- rect: left=457 top=84 right=99 bottom=501
  1045. -- title width / last selected line: 0
  1046. -- icon id / first selected line: 0 / 0
  1047. -- text alignment: 0
  1048. -- font id: 200
  1049. -- text size: 10
  1050. -- style flags: 0
  1051. -- line height: 13
  1052. -- part name: format field
  1053. ----- HyperTalk script -----
  1054. on mouseUp
  1055.   put line 1 of me into whichText
  1056.   if whichText is empty then exit mouseUp
  1057.   set cursor to busy
  1058.   findFormatSetup whichText
  1059. end mouseUp
  1060.  
  1061.  
  1062. -- part 111 (button)
  1063. -- low flags: 80
  1064. -- high flags: 8004
  1065. -- rect: left=368 top=8 right=27 bottom=505
  1066. -- title width / last selected line: 0
  1067. -- icon id / first selected line: 0 / 0
  1068. -- text alignment: 1
  1069. -- font id: 0
  1070. -- text size: 12
  1071. -- style flags: 0
  1072. -- line height: 16
  1073. -- part name: Card
  1074. ----- HyperTalk script -----
  1075. on mouseDown
  1076.   global cardMenu
  1077.   get menuPop(the name of me)
  1078.   put item 1 of it into menuT
  1079.   put item 2 of it into menuL
  1080.   get BigPop(cardMenu,menuT,menuL)
  1081.   put it into theChoice
  1082.   if theChoice = 1 then displayTiny
  1083.   if theChoice = 3 then
  1084.     assignToCard "keyword","keywords field","Keyword Index"
  1085.   end if
  1086.   if theChoice = 4 then
  1087.     deleteFromCard "Keyword","keywords field","Keyword Index"
  1088.   end if
  1089.   if theChoice = 6 then assignBook "appears in books field"
  1090.   if theChoice = 7 then deleteBook "appears in books field"
  1091.   set hilite of me to false
  1092. end mouseDown
  1093.  
  1094. on assignBook whichFld
  1095.   global DialogButton
  1096.   if whichFld = empty then put "appears in books field" into whichFld
  1097.   set cursor to watch
  1098.   put "Assign what book to this card?" into text
  1099.   put readIndex("book index") into theList
  1100.   get listDialog(theList,13,text,true,"Assign,New^,Cancel")
  1101.   put it into theAnswer
  1102.   if DialogButton = "cancel" then exit assignBook else
  1103.   if DialogButton = "new" then
  1104.     send addToBookIndex to bg btn "indexes"
  1105.     assignBook whichFld
  1106.   end if
  1107. end if
  1108. if line 1 of theAnswer <> empty then
  1109.   if last line of fld whichFld <> empty then put return into newBooks
  1110.   put return & line 1 of theAnswer after newBooks
  1111.   if line 2 of theAnswer <> empty then
  1112.     put return & line 2 of theAnswer after newBooks
  1113.   end if
  1114.   put fld "file name field" into fileName
  1115.   put the lockScreen
  1116.   ask "Enter "& quote & fileName & quote &"'s archive number."
  1117.   if it <> empty then put return & it after newBooks
  1118.   put newBooks after fld whichFld
  1119. end if
  1120. end assignBook
  1121.  
  1122. on deleteBook whichFld
  1123.   global DialogButton
  1124.   if whichFld = empty then put "appears in books field" into whichFld
  1125.   put "Delete what from the Books field of this card?" into text
  1126.   put fld whichFld into theList
  1127.   get listDialog(theList,13,text,true,"OK,Cancel")
  1128.   put it into theAnswer
  1129.   if DialogButton = "cancel" then exit deleteBook
  1130.   repeat with i = (the number of lines in theAnswer) down to 1
  1131.     delete line (line i of theAnswer) of fld whichFld
  1132.   end repeat
  1133.   set scroll of bg fld whichFld to 0
  1134. end deleteBook
  1135.  
  1136.  
  1137. -- part 31 (field)
  1138. -- low flags: 01
  1139. -- high flags: 0002
  1140. -- rect: left=308 top=84 right=99 bottom=398
  1141. -- title width / last selected line: 0
  1142. -- icon id / first selected line: 0 / 0
  1143. -- text alignment: 0
  1144. -- font id: 200
  1145. -- text size: 10
  1146. -- style flags: 0
  1147. -- line height: 13
  1148. -- part name: File Name field
  1149. ----- HyperTalk script -----
  1150. on mouseUp
  1151.   dialogIt "The file name uniquely identifies a graphic in the stack." && "Click the Find button to find a graphic with a specific file name."
  1152. end mouseUp
  1153.  
  1154.  
  1155. -- part 114 (button)
  1156. -- low flags: 80
  1157. -- high flags: 8004
  1158. -- rect: left=224 top=8 right=27 bottom=367
  1159. -- title width / last selected line: 0
  1160. -- icon id / first selected line: 0 / 0
  1161. -- text alignment: 1
  1162. -- font id: 0
  1163. -- text size: 12
  1164. -- style flags: 0
  1165. -- line height: 16
  1166. -- part name: Management
  1167. ----- HyperTalk script -----
  1168. on mouseDown
  1169.   global managementMenu
  1170.   get menuPop(the name of me)
  1171.   put item 1 of it into menuT
  1172.   put item 2 of it into menuL
  1173.   get BigPop(managementMenu,menuT,menuL)
  1174.   put it into theChoice
  1175.   if theChoice = 1 then setBrowseSpeed
  1176.   if theChoice = 2 then sortGraphics
  1177.   if theChoice = 4 then combineStacks
  1178.   if theChoice = 5 then createShell
  1179.   set the hilite of me to false
  1180. end mouseDown
  1181.  
  1182. on setBrowseSpeed
  1183.   global ticksToWait
  1184.   ask "Pause at card for how many seconds?" with (ticksToWait/60)
  1185.   put it into numberEntered
  1186.   if numberEntered is empty then exit setBrowseSpeed
  1187.   if nonNegativeNumber(numberEntered) then
  1188.     put (numberEntered*60) into ticksToWait
  1189.     put ticksToWait into cd fld "browsing speed" of cd "title card"
  1190.   else
  1191.     dialogIt "Please enter a positive number." && quote & numberEntered & quote && "is not a positive number."
  1192.   end if
  1193. end setBrowseSpeed
  1194.  
  1195. on sortGraphics
  1196.   if the lockMessages = false then
  1197.     answer "Sort graphics by File Name?" with Cancel or OK
  1198.     if it is "cancel" then exit sortGraphics
  1199.   end if
  1200.   toggleLockScreen
  1201.   push cd
  1202.   set cursor to busy
  1203.   sort by fld "file name field"
  1204.   pop cd
  1205. end sortGraphics
  1206.  
  1207. on combineStacks
  1208.   put FileName("STAK","Import data from what stack?") into dataStack
  1209.   if dataStack is empty then exit combineStacks
  1210.   toggleLockScreen
  1211.   put "stack" && quote before dataStack
  1212.   put quote after dataStack
  1213.   set cursor to busy
  1214.   put the long name of this stack into shellStack
  1215.   set lockMessages to true
  1216.   set lockRecent to true
  1217.   set cursor to busy
  1218.   lock screen
  1219.   go dataStack
  1220.   go bg "The Collection"
  1221.   collectIDs
  1222.   put the result into dataStackIDs
  1223.   compareIDs dataStackIDs, shellStack
  1224.   put the result into dataStackIDs
  1225.   copyTextToStack dataStackIDs,shellStack,dataStack
  1226.   put the result into newGraphics
  1227.   if newGraphics <> empty then
  1228.     showNew newGraphics, "Cards with these file names were added" && "to the stack."
  1229.   end if
  1230.   openBackground
  1231.   openCard
  1232.   choose browse tool
  1233. end combineStacks
  1234.  
  1235. on copyTextToStack dataStackIDs,shellStack,dataStack
  1236.   put empty into newGraphics
  1237.   go shellStack
  1238.   go bg "The Collection"
  1239.   go last cd of this bg
  1240.   put the long name of this cd into shellCd
  1241.   put "Copying text from cards" into status
  1242.   go dataStack
  1243.   put cd fld "paths to graphics" of cd "title card" into newPaths
  1244.   put readIndex("keyword index") into newKeywords
  1245.   go bg "the collection"
  1246.   put the long name of this cd into dataCd
  1247.   repeat with i = 1 to the number of lines in dataStackIDs
  1248.     showProgress status,round(i/(the number of lines in dataStackIDs)*100)
  1249.     set cursor to busy
  1250.     go dataCd
  1251.     find whole (line i of dataStackIDs) in fld "file name field"
  1252.     put the long name of this cd into dataCd
  1253.     put fld "description field" into description
  1254.     put fld "file name field" into graphicID
  1255.     put fld "format field" into graphicFormat
  1256.     put fld "keywords field" into keywords
  1257.     put fld "appears in books field" into books
  1258.     if cardPictureExists() then
  1259.       copyThumbnail
  1260.       put true into pictOnClipboard
  1261.     else put false into pictOnClipboard
  1262.     go shellCd
  1263.     doMenu "new card"
  1264.     put the long name of this cd into shellCd
  1265.     setCdNo
  1266.     unlock screen
  1267.     put description into fld "description field"
  1268.     put keywords into fld "keywords field"
  1269.     put graphicID into fld "file name field"
  1270.     put fld "file name field" & return after newGraphics
  1271.     put graphicFormat into fld "format field"
  1272.     put books into fld "appears in books field"
  1273.     if pictOnClipboard then
  1274.       --a thumbnail needs to be pasted onto the card.
  1275.       type "V" with commandKey
  1276.     end if
  1277.     lock screen
  1278.     choose browse tool
  1279.   end repeat
  1280.   hideProgress
  1281.   put readIndex("keyword index") into oldKeywords
  1282.   checkDocuments newPaths
  1283.   repeat with N = 1 to the number of lines in newKeywords
  1284.     if not isWithin(line N of newKeywords,oldKeywords) then
  1285.       put return & line N of newKeywords after oldKeywords
  1286.     end if
  1287.   end repeat
  1288.   writeIndex sortContainer(oldKeywords),"keyword index"
  1289.   go bg "The Collection"
  1290.   -- currently at the first cd
  1291.   if fld "file name field" = empty then doMenu "delete card"
  1292.   return newGraphics
  1293. end copyTextToStack
  1294.  
  1295. on collectIDs
  1296.   go first cd of this bg
  1297.   put "Collecting File Names" into status
  1298.   repeat with j = 1 to the number of cds in this bg
  1299.     showProgress status,round(j/(the number of cds in this bg)*100)
  1300.     set cursor to busy
  1301.     put fld "file name field" & return after listOfIDs
  1302.     go next cd of this bg
  1303.   end repeat
  1304.   hideProgress
  1305.   return listOfIDs
  1306. end collectIDs
  1307.  
  1308. on compareIDs dataStackIDs, shellStack
  1309.   go shellStack
  1310.   go bg "the collection"
  1311.   put 1 into i
  1312.   put empty into alreadyExists
  1313.   put "Comparing File Names" into status
  1314.   repeat with j = 1 to the number of lines in dataStackIDs
  1315.     showProgress status,round(j/(the number of lines in dataStackIDs)*100)
  1316.     set cursor to busy
  1317.     find whole (line i of dataStackIDs) in fld "file name field"
  1318.     if the foundField = empty then
  1319.       --this file name needs to be added to the shell stack
  1320.       add 1 to i
  1321.     else
  1322.       --this file name already exists in the shell stack
  1323.       put line i of dataStackIDs & return after alreadyExists
  1324.       delete line i of dataStackIDs
  1325.     end if
  1326.   end repeat
  1327.   hideProgress
  1328.   if alreadyExists <> empty then showExisting alreadyExists
  1329.   return dataStackIDs
  1330. end compareIDs
  1331.  
  1332. on createShell
  1333.   global activeListName
  1334.   dialogIt "Delete all cards in this background except for one?","Cancel,OK"
  1335.   if the result = "Cancel" then exit createShell
  1336.   toggleLockScreen
  1337.   lock screen
  1338.   set lockMessages to true
  1339.   set lockRecent to true
  1340.   go first cd of this bg
  1341.   choose select tool
  1342.   drag from 0,0 to 300,300
  1343.   doMenu "Clear Picture"
  1344.   choose browse tool
  1345.   put empty into fld "description field"
  1346.   put empty into fld "file name field"
  1347.   put empty into fld "format field"
  1348.   put empty into fld "keywords field"
  1349.   put empty into fld "appears in books field"
  1350.   go next cd of this bg
  1351.   put the number of cds in this bg into N
  1352.   put (N - 1) into deleteThisMany
  1353.   if deleteThisMany > 0 then
  1354.     put "Deleting cards" into status
  1355.     repeat with i = 1 to deleteThisMany
  1356.       showProgress status,round(i/N*100)
  1357.       set cursor to busy
  1358.       if the short name of this bg = "The Collection" then
  1359.         doMenu "delete card"
  1360.       end if
  1361.     end repeat
  1362.     hideProgress
  1363.   end if
  1364.   go cd "title card"
  1365.   if the result <> empty then answer the result else
  1366.   repeat with i = 1 to the number of cd flds
  1367.     put empty into cd fld i
  1368.   end repeat
  1369. end if
  1370. put "Untitled" into activeListName
  1371. go bg "The Collection"
  1372. doMenu "compact stack"
  1373. setCdNo
  1374. end createShell
  1375.  
  1376.  
  1377. -- part 163 (button)
  1378. -- low flags: 00
  1379. -- high flags: A002
  1380. -- rect: left=128 top=32 right=55 bottom=229
  1381. -- title width / last selected line: 0
  1382. -- icon id / first selected line: 0 / 0
  1383. -- text alignment: 1
  1384. -- font id: 200
  1385. -- text size: 12
  1386. -- style flags: 0
  1387. -- line height: 16
  1388. -- part name: Open Graphic
  1389. ----- HyperTalk script -----
  1390. on mouseUp
  1391.   displayPicture
  1392. end mouseUp
  1393.  
  1394.  
  1395. -- part 217 (button)
  1396. -- low flags: 00
  1397. -- high flags: A002
  1398. -- rect: left=145 top=282 right=306 bottom=233
  1399. -- title width / last selected line: 0
  1400. -- icon id / first selected line: 0 / 0
  1401. -- text alignment: 1
  1402. -- font id: 200
  1403. -- text size: 12
  1404. -- style flags: 0
  1405. -- line height: 16
  1406. -- part name: Quit
  1407. ----- HyperTalk script -----
  1408. on mouseUp
  1409.   doMenu "quit hypercard"
  1410. end mouseUp
  1411.  
  1412.  
  1413. -- part 238 (button)
  1414. -- low flags: 00
  1415. -- high flags: 0002
  1416. -- rect: left=94 top=282 right=306 bottom=146
  1417. -- title width / last selected line: 0
  1418. -- icon id / first selected line: 7516 / 7516
  1419. -- text alignment: 1
  1420. -- font id: 200
  1421. -- text size: 12
  1422. -- style flags: 256
  1423. -- line height: 16
  1424. -- part name: Help
  1425. ----- HyperTalk script -----
  1426. --PASTE THE HELP FUNCTIONS OVER THE EXISTING FUNCTIONS IN THIS SCRIPT
  1427.  
  1428. on mouseUp
  1429.   global cardMenu, catalogMenu, managementMenu, indexesMenu
  1430.   showHelp (not the visible of fld "banner")
  1431.   displayHelp "Banner"
  1432.   set cursor to 16
  1433.   repeat
  1434.  
  1435.     --if they have one of these keys down, it may indicate they
  1436.     --are a bit confused or just want to move on, so exit.
  1437.     if the commandKey is down then
  1438.       cleanExit
  1439.       exit repeat
  1440.     end if
  1441.     if the optionKey is down then
  1442.       cleanExit
  1443.       exit mouseUp
  1444.     end if
  1445.  
  1446.     if the mouse is down then
  1447.       --the user clicked somewhere
  1448.       put the mouseLoc into userLoc
  1449.       if item 1 of userLoc < 0 OR item 1 of userLoc > 512 OR item 2 of userLoc < -15 OR item 2 of userLoc > 345
  1450.       then
  1451.       --you clicked outside of the card
  1452.       cleanExit
  1453.       exit mouseUp
  1454.     end if
  1455.  
  1456.     --menus
  1457.     if userLoc is within the rect of bg btn "Card" then
  1458.       menuHelp cardMenu, "Card"
  1459.     end if
  1460.     if userLoc is within the rect of bg btn "catalog" then
  1461.       menuHelp catalogMenu, "catalog"
  1462.     end if
  1463.     if userLoc is within the rect of bg btn "Management" then
  1464.       menuHelp ManagementMenu, "Management"
  1465.     end if
  1466.     if userLoc is within the rect of bg btn "Indexes" then
  1467.       menuHelp indexesMenu, "Indexes"
  1468.     end if
  1469.  
  1470.     --btns whose names may change or have names that HyperTalk
  1471.     --doesn't like
  1472.     if userLoc is within the rect of bg btn id 216 then
  1473.       displayHelp "Card Number Btn"
  1474.     end if
  1475.     if userLoc is within the rect of bg btn id 353 then
  1476.       displayHelpByID "list Name","353"
  1477.     end if
  1478.     if userLoc is within the rect of bg btn id 313 then
  1479.       displayHelpBtn "Delete #‚Ķ"
  1480.     end if
  1481.  
  1482.     --help objects
  1483.     if userLoc is within the rect of fld "banner" then
  1484.       displayHelpFld "banner"
  1485.     end if
  1486.     if userLoc is within the rect of bg btn "Help Close" OR userLoc is within the rect of bg btn "help" then
  1487.       cleanExit
  1488.       exit mouseUp
  1489.     end if
  1490.     if userLoc is within the rect of bg btn "Help Section" then
  1491.       displayHelp "banner"
  1492.     end if
  1493.     if the mouseLoc is within the rect of bg btn "Help Close" OR the mouseLoc is within the rect of bg btn "Help" then
  1494.       set cursor to arrow
  1495.     end if
  1496.  
  1497.     --other btns
  1498.     repeat with i = 1 to the number of bg btns
  1499.       if userLoc is within the rect of bg btn i then
  1500.         --check for all of the exceptions
  1501.         put id of bg btn i into thisID
  1502.         put the short name of bg btn i into thisName
  1503.         --check to see if there is help on this button
  1504.         if the short name of bg btn i = "info blanket" OR thisID = 216 OR thisID = 353 OR thisID = 313 OR thisName = "Card" OR thisName = "catalog" OR thisName = "management" OR thisName = "indexes" OR thisName = "lists view" or thisName = "graphics view" OR thisName = "menu blanket" then next repeat
  1505.         else
  1506.           --there is help on this button
  1507.           displayHelpBtn (the short name of bg btn i)
  1508.         end if
  1509.       end if
  1510.     end repeat
  1511.  
  1512.     --flds
  1513.     repeat with i = 1 to the number of bg flds
  1514.       if userLoc is within the rect of fld i then
  1515.         displayHelpFld (the short name of fld i)
  1516.       end if
  1517.     end repeat
  1518.     set cursor to 16
  1519.   end if
  1520. end repeat
  1521. end mouseUp
  1522.  
  1523. on displayHelpByID messageText,btnId
  1524.   if the visible of bg btn id btnId then displayHelp messageText
  1525.   else exit displayHelpByID
  1526. end displayHelpByID
  1527.  
  1528. on displayHelpFld messageText
  1529.   if the visible of fld messageText then displayHelp messageText
  1530.   else exit displayHelpFld
  1531. end displayHelpFld
  1532.  
  1533. on displayHelpBtn messageText
  1534.   if the visible of bg btn messageText then displayHelp messageText
  1535.   else exit displayHelpBtn
  1536. end displayHelpBtn
  1537.  
  1538. on displayHelp messageText
  1539.   put messageText into helpFunction
  1540.   put substitute("#","",helpFunction) into helpFunction
  1541.   put substitute(":","",helpFunction) into helpFunction
  1542.   put substitute("‚Ķ","",helpFunction) into helpFunction
  1543.   put substitute(" ","",helpFunction) into helpFunction
  1544.   put "()" after helpFunction
  1545.   do "get" && helpFunction
  1546.   put it into fld "banner"
  1547. end displayHelp
  1548.  
  1549. on cleanExit
  1550.   set the icon of bg btn "Help Close" to 3358
  1551.   showHelp false
  1552.   set the icon of bg btn "Help Close" to 3071
  1553.   put empty into fld "banner"
  1554. end cleanExit
  1555.  
  1556. on menuHelp menu, btnName
  1557.   if the visible of bg btn btnName is false then exit menuHelp
  1558.   set hilite of bg btn btnName to true
  1559.   get menuPop("bg btn" && btnName)
  1560.   put item 1 of it into menuT
  1561.   put item 2 of it into menuL
  1562.   get BigPop(menu,menuT,menuL)
  1563.   set hilite of bg btn btnName to false
  1564.   if it = empty then exit menuHelp
  1565.   else displayHelp (line it of menu)
  1566. end menuHelp
  1567.  
  1568. ----------------------------------------------------------------------
  1569. --PASTE THE NEW HELP FUNCTIONS AFTER THIS LINE
  1570. ----------------------------------------------------------------------
  1571.  
  1572. function BuildThumbnail
  1573. return "Build Thumbnail replaces any existing thumbnail sketch on the current card and pastes a new thumbnail sketch." & return
  1574. end BuildThumbnail
  1575.  
  1576. function AboutThisGraphic
  1577. return "About This Graphic displays information about the current graphic (for example, it‚Äôs description, file name, keywords, etc.). " & return
  1578. end AboutThisGraphic
  1579.  
  1580. function Lists
  1581. return "Lists displays the open list and hides information about the current graphic." & return &return &"To add graphics to the open list, click Add This Graphic. To save a list, click Save. To go to a graphic in the list, click its entry in the list." & return
  1582. end Lists
  1583.  
  1584. function AssignKeyword
  1585. return "Assign Keyword enables you to select an existing keyword or keywords to assign to the current graphic." & return
  1586. end AssignKeyword
  1587.  
  1588. function AssignBook
  1589. return "Assign Book enables you to select an existing book to assign to the current graphic." & return
  1590. end AssignBook
  1591.  
  1592. function CardNumberBtn
  1593. return "This button gives you information about your location in the stack. Click it as a short-cut to using Find to locate a card by its number." & return
  1594. end CardNumberBtn
  1595.  
  1596. function Quit
  1597. return "Quit closes the stack and leaves HyperCard." & return
  1598. end Quit
  1599.  
  1600. function Find
  1601. return "Click Find to search for graphics by different criteria (for example, File Name, Format, Keywords, etc.)" & return
  1602. end Find
  1603.  
  1604. function Delete
  1605. return "Click Delete #  to delete entries from the open list." & return &return &"After you click Delete #,click on the list entries you want to remove. When you are finished deleting entries, click Done." & return
  1606. end Delete
  1607.  
  1608. function NewList
  1609. return "New List opens a new, empty list named Untitled.  If another list is already open, the stack closes it " & return &"(after prompting you to save changes) before opening a new list. Only one list can be open at a time." & return &return &"To add items to the list, click Add This Graphic to List (or press control-A). " & return
  1610. end NewList
  1611.  
  1612. function ListName
  1613. return "This is the name of the open list." & return
  1614. end ListName
  1615.  
  1616. function ListHeadingField
  1617. return "This is the heading that describes the contents of the list." & return
  1618. end ListHeadingField
  1619.  
  1620. function DeleteList
  1621. return "Delete List erases the list that you specify. Click Delete List when you no longer need a particular list." & return
  1622. end DeleteList
  1623.  
  1624. function PrintList
  1625. return "Print List prints the open list. You can print a list along with the thumbnail sketches of the list items, or print just the text of the list (the descriptions and file name of the items)." & return
  1626. end PrintList
  1627.  
  1628. function Save
  1629. return "Save saves a list to disk." & return
  1630. end Save
  1631.  
  1632. function FileName
  1633. return "Click File Name as a short-cut to clicking Find and searching for graphics by File Name." & return
  1634. end FileName
  1635.  
  1636. function FileNameField
  1637. return "Each graphic file is stored referred to in this stack is stored as a separate file. The name of this file is displayed in the File Name field." & return
  1638. end FileNameField
  1639.  
  1640. function List
  1641. return "The List field displays the open list. Click an entry in the list to go to that graphic." & return
  1642. end List
  1643.  
  1644. function AppearsInBooks
  1645. return "Click Appears In Books as a short-cut to clicking Find and searching for graphics by book." & return
  1646. end AppearsInBooks
  1647.  
  1648. function AppearsInBooksField
  1649. return "The Appears in Books field displays the books (along with the books‚Äô Engineering Part Numbers) in which this graphic appears." & return &return &"Click any of the books (or Engineering Part Numbers) to search through graphics from that book." & return
  1650. end AppearsInBooksField
  1651.  
  1652. function Keywords
  1653. return "Click Keywords as a short-cut to clicking Find and searching for graphics by keyword." & return &return &return
  1654. end Keywords
  1655.  
  1656. function KeywordsField
  1657. return "The Keywords field displays the keywords assigned to describe this graphic." & return &return &"Click any of the keywords to search through graphics with that keyword." & return &return
  1658. end KeywordsField
  1659.  
  1660. function Description
  1661. return "Click Description as a short-cut to clicking Find and searching for graphics by description." & return
  1662. end Description
  1663.  
  1664. function DescriptionField
  1665. return "The Description field displays the description of this graphic." & return &return &"Click this field to search through graphics with the description of the current graphic." & return
  1666. end DescriptionField
  1667.  
  1668. function Format
  1669. return "Click Format as a short-cut to clicking Find and searching for graphics by format." & return
  1670. end Format
  1671.  
  1672. function FormatField
  1673. return "The Format field displays the file format (or file type) of this graphic. " & return &return &"Click this field to search through graphics that are stored in the same format as the current graphic." & return
  1674. end FormatField
  1675.  
  1676. function AddThisGraphic
  1677. return "Add This Graphic puts the description and file name of the current graphic at the end of the open list. You can add up to 50 graphics to a list. As a short-cut to clicking this button, press control-A." & return &return &"You can continue to add graphics to the list, even if the list is hidden  (as it is when information about the current graphic is visible)." & return
  1678. end AddThisGraphic
  1679.  
  1680. function OpenList
  1681. return "Open List enables you to open a list you have saved.  If another list is already open, the stack closes it " & return &"(after prompting you to save changes) before opening the specified list. Only one list can be open at a time." & return
  1682. end OpenList
  1683.  
  1684. function CatalogVolume
  1685. return "Choose Catalog Volume to catalog all of the graphics on a volume (or disk). For each graphic found on the volume, a card is created in the" & return &" stack, the thumbnail is created, and the file name, file type, and file path are put into the appropriate fields." & return
  1686. end CatalogVolume
  1687.  
  1688. function CatalogFolder
  1689. return "Choose Catalog Folder to catalog all of the within a specified folder. For each graphic found in the folder, a card is created in the" & return &" stack, a thumbnail is created, and the file name, file type, and file path are put into the appropriate fields." & return
  1690. end CatalogFolder
  1691.  
  1692. function CatalogFile
  1693. return "Choose Catalog File to catalog a specified file. If the file is stored in an acceptable file format, a card is created in the stack, a thumbnail is " & return &"created, and the file name, file type, and file path are put into the appropriate fields." & return
  1694. end CatalogFile
  1695.  
  1696. function SetBrowsingSpeed
  1697. return "Set Browsing Speed lets you change the speed of browsing and searching through graphics.  " & return
  1698. end SetBrowsingSpeed
  1699.  
  1700. function ImportData
  1701. return "Import Data allows you to add the graphics and text from a specified stack to the end of the open stack." & return
  1702. end ImportData
  1703.  
  1704. function SortbyFileName
  1705. return "Sort by File Name sorts the graphic cards by their file name." & return
  1706. end SortbyFileName
  1707.  
  1708. function DeleteData
  1709. return "Delete Data deletes all but one of the cards in the background The Collection. On the remaining card, the thumbnail is removed and the fields are emptied." & return
  1710. end DeleteData
  1711.  
  1712. function BuildKeywordIndex
  1713. return "Build Keyword Index goes to every graphics card and collects all of the assigned keywords. The keywords are sorted and stored on the Title Card." & return
  1714. end BuildKeywordIndex
  1715.  
  1716. function BuildBookIndex
  1717. return "Build Book Index goes to every graphics card and collects all of the assigned books. The books are sorted and stored on the Title Card." & return
  1718. end BuildBookIndex
  1719.  
  1720. function AddtoKeywordIndex
  1721. return "Add to Keyword Index allows you to add new keywords to the Keyword Index." & return
  1722. end AddtoKeywordIndex
  1723.  
  1724. function DeleteKeyword
  1725. return "Delete Keyword enables you to delete a keyword from the current card." & return
  1726. end DeleteKeyword
  1727.  
  1728. function DeleteBook
  1729. return "Delete Book enables you to delete a book from the current card." & return
  1730. end DeleteBook
  1731.  
  1732. function DeletefromKeywordIndex
  1733. return "Delete from Keyword Index enables you to delete a term from this index. After you select a term or terms, the stack finds each instance in the appropriate field" & return &" and confirms that you want to delete this term from this card. (To avoid the confirmation dialog box, hold down the Option key.)" & return
  1734. end DeletefromKeywordIndex
  1735.  
  1736. function AddtoBookIndex
  1737. return "Add to Book Index allows you to add new books to the Book Index." & return
  1738. end AddtoBookIndex
  1739.  
  1740. function DeletefromBookIndex
  1741. return "Delete from Book Index enables you to delete a term from this index. After you select a term or terms, the stack finds each instance in the appropriate field" & return &" and confirms that you want to delete this term from this card. (To avoid the confirmation dialog box, hold down the Option key.)" & return &return
  1742. end DeletefromBookIndex
  1743.  
  1744. function ExportKeywordIndex
  1745. return "Export Keyword Index creates a text file of all keywords assigned to graphics." & return
  1746. end ExportKeywordIndex
  1747.  
  1748. function ExportBookIndex
  1749. return "Export Book Index creates a text file of all books assigned to graphics." & return
  1750. end ExportBookIndex
  1751.  
  1752. function Next
  1753. return "This is the Next Card button. Click it to see the next card in the stack, or click and hold down the mouse button to browse through the cards." & return &return &"To change the browsing speed of the stack, hold down the Command key and click the Next Card button or the Previous Card button." & return
  1754. end Next
  1755.  
  1756. function Prev
  1757. return "This is the Previous Card button. Click it to see the previous card in the stack, or click and hold down the mouse button to browse through the cards. " & return &return &"To change the browsing speed of the stack, hold down the Command key and click the Next Card button or the Previous Card button." & return &return
  1758. end Prev
  1759.  
  1760. function OpenGraphic
  1761. return "Click Open Graphic to see the original (full-size) version of the graphic on the current card." & return &return &"Once the original grahic is open, you can copy or print all, or a selection of, the graphic." & return
  1762. end OpenGraphic
  1763.  
  1764. function Banner
  1765. return return &"    Welcome to the Help Section" & return &return &"‚Ä¢  Use the Help cursor (the question" & return &"    mark) to click buttons and fields" & return &"    to find out about them." & return &return &"‚Ä¢  To leave Help and return to the " & return &"     graphics, click the close box " & return &"     of this panel." & return &return
  1766. end Banner
  1767.  
  1768. function HelpSection
  1769. return return &"    Welcome to the Help Section" & return &return &"‚Ä¢  Use the Help cursor (the question" & return &"    mark) to click buttons and fields" & return &"    to find out about them." & return &return &"‚Ä¢  To leave Help and return to the " & return &"     graphics, click the close box " & return &"     of this panel." & return &return
  1770. end HelpSection
  1771.  
  1772.  
  1773. return "Build Thumbnail replaces any existing thumbnail sketch on the current card and pastes a new thumbnail sketch." & return
  1774. end BuildThumbnail
  1775.  
  1776. function AboutThisGraphic
  1777. return "About This Graphic displays information about the current graphic (for example, it‚Äôs description, file name, keywords, etc.). " & return
  1778. end AboutThisGraphic
  1779.  
  1780. function Lists
  1781. return "Lists displays the open list and hides information about the current graphic." & return &return &"To add graphics to the open list, click Add This Graphic. To save a list, click Save. To go to a graphic in the list, click its entry in the list." & return
  1782. end Lists
  1783.  
  1784. function AssignKeyword
  1785. return "Assign Keyword enables you to select an existing keyword or keywords to assign to the current graphic." & return
  1786. end AssignKeyword
  1787.  
  1788. function AssignBook
  1789. return "Assign Book enables you to select an existing book to assign to the current graphic." & return
  1790. end AssignBook
  1791.  
  1792. function CardNumberBtn
  1793. return "This button gives you information about your location in the stack. Click it as a short-cut to using Find to locate a card by its number." & return
  1794. end CardNumberBtn
  1795.  
  1796. function Quit
  1797. return "Quit closes the stack and leaves HyperCard." & return
  1798. end Quit
  1799.  
  1800. function Find
  1801. return "Click Find to search for graphics by different criteria (for example, File Name, Format, Keywords, etc.)" & return
  1802. end Find
  1803.  
  1804. function Delete
  1805. return "Click Delete #  to delete entries from the open list." & return &return &"After you click Delete #,click on the list entries you want to remove. When you are finished deleting entries, click Done." & return
  1806. end Delete
  1807.  
  1808. function NewList
  1809. return "New List opens a new, empty list named Untitled.  If another list is already open, the stack closes it " & return &"(after prompting you to save changes) before opening a new list. Only one list can be open at a time." & return &return &"To add items to the list, click Add This Graphic to List (or press control-A). " & return
  1810. end NewList
  1811.  
  1812. function ListName
  1813. return "This is the name of the open list." & return
  1814. end ListName
  1815.  
  1816. function ListHeadingField
  1817. return "This is the heading that describes the contents of the list." & return
  1818. end ListHeadingField
  1819.  
  1820. function DeleteList
  1821. return "Delete List erases the list that you specify. Click Delete List when you no longer need a particular list." & return
  1822. end DeleteList
  1823.  
  1824. function PrintList
  1825. return "Print List prints the open list. You can print a list along with the thumbnail sketches of the list items, or print just the text of the list (the descriptions and file name of the items)." & return
  1826. end PrintList
  1827.  
  1828. function Save
  1829. return "Save saves a list to disk." & return
  1830. end Save
  1831.  
  1832. function FileName
  1833. return "Click File Name as a short-cut to clicking Find and searching for graphics by File Name." & return
  1834. end FileName
  1835.  
  1836. function FileNameField
  1837. return "Each graphic file is stored referred to in this stack is stored as a separate file. The name of this file is displayed in the File Name field." & return
  1838. end FileNameField
  1839.  
  1840. function List
  1841. return "The List field displays the open list. Click an entry in the list to go to that graphic." & return
  1842. end List
  1843.  
  1844. function AppearsInBooks
  1845. return "Click Appears In Books as a short-cut to clicking Find and searching for graphics by book." & return
  1846. end AppearsInBooks
  1847.  
  1848. function AppearsInBooksField
  1849. return "The Appears in Books field displays the books (along with the books‚Äô Engineering Part Numbers) in which this graphic appears." & return &return &"Click any of the books (or Engineering Part Numbers) to search through graphics from that book." & return
  1850. end AppearsInBooksField
  1851.  
  1852. function Keywords
  1853. return "Click Keywords as a short-cut to clicking Find and searching for graphics by keyword." & return &return &return
  1854. end Keywords
  1855.  
  1856. function KeywordsField
  1857. return "The Keywords field displays the keywords assigned to describe this graphic." & return &return &"Click any of the keywords to search through graphics with that keyword." & return &return
  1858. end KeywordsField
  1859.  
  1860. function Description
  1861. return "Click Description as a short-cut to clicking Find and searching for graphics by description." & return
  1862. end Description
  1863.  
  1864. function DescriptionField
  1865. return "The Description field displays the description of this graphic." & return &return &"Click this field to search through graphics with the description of the current graphic." & return
  1866. end DescriptionField
  1867.  
  1868. function Format
  1869. return "Click Format as a short-cut to clicking Find and searching for graphics by format." & return
  1870. end Format
  1871.  
  1872. function FormatField
  1873. return "The Format field displays the file format (or file type) of this graphic. " & return &return &"Click this field to search through graphics that are stored in the same format as the current graphic." & return
  1874. end FormatField
  1875.  
  1876. function AddThisGraphic
  1877. return "Add This Graphic puts the description and file name of the current graphic at the end of the open list. You can add up to 50 graphics to a list. As a short-cut to clicking this button, press control-A." & return &return &"You can continue to add graphics to the list, even if the list is hidden  (as it is when information about the current graphic is visible)." & return
  1878. end AddThisGraphic
  1879.  
  1880. function OpenList
  1881. return "Open List enables you to open a list you have saved.  If another list is already open, the stack closes it " & return &"(after prompting you to save changes) before opening the specified list. Only one list can be open at a time." & return
  1882. end OpenList
  1883.  
  1884. function CatalogVolume
  1885. return "Choose Catalog Volume to catalog all of the graphics on a volume (or disk). For each graphic found on the volume, a card is created in the" & return &" stack, the thumbnail is created, and the file name, file type, and file path are put into the appropriate fields." & return
  1886. end CatalogVolume
  1887.  
  1888. function CatalogFolder
  1889. return "Choose Catalog Folder to catalog all of the within a specified folder. For each graphic found in the folder, a card is created in the" & return &" stack, a thumbnail is created, and the file name, file type, and file path are put into the appropriate fields." & return
  1890. end CatalogFolder
  1891.  
  1892. function CatalogFile
  1893. return "Choose Catalog File to catalog a specified file. If the file is stored in an acceptable file format, a card is created in the stack, a thumbnail is " & return &"created, and the file name, file type, and file path are put into the appropriate fields." & return
  1894. end CatalogFile
  1895.  
  1896. function SetBrowsingSpeed
  1897. return "Set Browsing Speed lets you change the speed of browsing and searching through graphics.  " & return
  1898. end SetBrowsingSpeed
  1899.  
  1900. function ImportData
  1901. return "Import Data allows you to add the graphics and text from a specified stack to the end of the open stack." & return
  1902. end ImportData
  1903.  
  1904. function SortbyFileName
  1905. return "Sort by File Name sorts the graphic cards by their file name." & return
  1906. end SortbyFileName
  1907.  
  1908. function DeleteData
  1909. return "Delete Data deletes all but one of the cards in the background The Collection. On the remaining card, the thumbnail is removed and the fields are emptied." & return
  1910. end DeleteData
  1911.  
  1912. function BuildKeywordIndex
  1913. return "Build Keyword Index goes to every graphics card and collects all of the assigned keywords. The keywords are sorted and stored on the Title Card." & return
  1914. end BuildKeywordIndex
  1915.  
  1916. function BuildBookIndex
  1917. return "Build Book Index goes to every graphics card and collects all of the assigned books. The books are sorted and stored on the Title Card." & return
  1918. end BuildBookIndex
  1919.  
  1920. function AddtoKeywordIndex
  1921. return "Add to Keyword Index allows you to add new keywords to the Keyword Index." & return
  1922. end AddtoKeywordIndex
  1923.  
  1924. function DeleteKeyword
  1925. return "Delete Keyword enables you to delete a keyword from the current card." & return
  1926. end DeleteKeyword
  1927.  
  1928. function DeleteBook
  1929. return "Delete Book enables you to delete a book from the current card." & return
  1930. end DeleteBook
  1931.  
  1932. function DeletefromKeywordIndex
  1933. return "Delete from Keyword Index enables you to delete a term from this index. After you select a term or terms, the stack finds each instance in the appropriate field" & return &" and confirms that you want to delete this term from this card. (To avoid the confirmation dialog box, hold down the Option key.)" & return
  1934. end DeletefromKeywordIndex
  1935.  
  1936. function AddtoBookIndex
  1937. return "Add to Book Index allows you to add new books to the Book Index." & return
  1938. end AddtoBookIndex
  1939.  
  1940. function DeletefromBookIndex
  1941. return "Delete from Book Index enables you to delete a term from this index. After you select a term or terms, the stack finds each instance in the appropriate field" & return &" and confirms that you want to delete this term from this card. (To avoid the confirmation dialog box, hold down the Option key.)" & return &return
  1942. end DeletefromBookIndex
  1943.  
  1944. function ExportKeywordIndex
  1945. return "Export Keyword Index creates a text file of all keywords assigned to graphics." & return
  1946. end ExportKeywordIndex
  1947.  
  1948. function ExportBookIndex
  1949. return "Export Book Index creates a text file of all books assigned to graphics." & return
  1950. end ExportBookIndex
  1951.  
  1952. function Next
  1953. return "This is the Next Card button. Click it to see the next card in the stack, or click and hold down the mouse button to browse through the cards." & return &return &"To change the browsing speed of the stack, hold down the Command key and click the Next Card button or the Previous Card button." & return
  1954. end Next
  1955.  
  1956. function Prev
  1957. return "This is the Previous Card button. Click it to see the previous card in the stack, or click and hold down the mouse button to browse through the cards. " & return &return &"To change the browsing speed of the stack, hold down the Command key and click the Next Card button or the Previous Card button." & return &return
  1958. end Prev
  1959.  
  1960. function OpenGraphic
  1961. return "Click Open Graphic to see the original (full-size) version of the graphic on the current card." & return &return &"Once the original grahic is open, you can copy or print all, or a selection of, the graphic." & return
  1962. end OpenGraphic
  1963.  
  1964. function Banner
  1965. return return &"    Welcome to the Help Section" & return &return &"‚Ä¢  Use the Help cursor (the question" & return &"    mark) to click buttons and fields" & return &"    to find out about them." & return &return &"‚Ä¢  To leave Help and return to the " & return &"     graphics, click the close box " & return &"     of this panel." & return &return
  1966. end Banner
  1967.  
  1968. function HelpSection
  1969. return return &"    Welcome to the Help Section" & return &return &"‚Ä¢  Use the Help cursor (the question" & return &"    mark) to click buttons and fields" & return &"    to find out about them." & return &return &"‚Ä¢  To leave Help and return to the " & return &"     graphics, click the close box " & return &"     of this panel." & return &return
  1970. end HelpSection
  1971.  
  1972.  
  1973.  
  1974.  
  1975. -- part 274 (button)
  1976. -- low flags: 80
  1977. -- high flags: 8004
  1978. -- rect: left=124 top=8 right=27 bottom=223
  1979. -- title width / last selected line: 0
  1980. -- icon id / first selected line: 0 / 0
  1981. -- text alignment: 1
  1982. -- font id: 0
  1983. -- text size: 12
  1984. -- style flags: 0
  1985. -- line height: 16
  1986. -- part name: Indexes
  1987. ----- HyperTalk script -----
  1988. on mouseDown
  1989.   global indexesMenu
  1990.   get menuPop(the name of me)
  1991.   put item 1 of it into menuT
  1992.   put item 2 of it into menuL
  1993.   get BigPop(indexesMenu,menuT,menuL)
  1994.   put it into theChoice
  1995.   if theChoice = 1 then buildIndex "keywords field","Keyword Index"
  1996.   if theChoice = 2 then addToIndex "keyword","Keyword Index"
  1997.   if theChoice = 3 then deleteFromIndex "Keywords field","Keyword Index"
  1998.   if theChoice = 4 then
  1999.     exportIndex "Keyword Index","Graphics Keyword Index"
  2000.   end if
  2001.   if theChoice = 6 then buildBookIndex
  2002.   if theChoice = 7 then addToBookIndex
  2003.   if theChoice = 8 then
  2004.     deleteFromIndex "Appears in Books field", "Book Index"
  2005.   end if
  2006.   if theChoice = 9 then exportIndex "book index","Graphics Book Index"
  2007.   set the hilite of me to false
  2008. end mouseDown
  2009.  
  2010. --Book stuff
  2011.  
  2012. on addToBookIndex
  2013.   ask "Enter the name of the new book:"
  2014.   if it = empty then exit addToBookIndex
  2015.   put it into addThis
  2016.   put readIndex("book index") into bookIndex
  2017.   if isWithin(addThis,bookIndex) then
  2018.     dialogIt "The book" &"e& addThis "e&& "already exists in the Book Index."
  2019.     exit addToBookIndex
  2020.   end if
  2021.   ask "What is the Eng. part number?"
  2022.   if it = empty then put empty into engPartNo
  2023.   else put return & it into engPartNo
  2024.   put return & addThis & engPartNo after bookIndex
  2025.   writeIndex bookIndex, "book index"
  2026.   deleteDeadLines
  2027.   sortBookIndex
  2028.   formatBookIndex
  2029. end addToBookIndex
  2030.  
  2031. on buildBookIndex
  2032.   if the lockMessages = false then
  2033.     answer "Build the Book Index?" with "Cancel" or "OK"
  2034.     if it is "Cancel" then exit buildBookIndex
  2035.   end if
  2036.   collectBooks
  2037.   get cd fld "book index" of cd "title card"
  2038.   if it is empty then exit buildBookIndex
  2039.   sortBookIndex
  2040.   formatBookIndex
  2041. end buildBookIndex
  2042.  
  2043. on collectBooks
  2044.   lock screen
  2045.   set lockMessages to true
  2046.   set lockRecent to true
  2047.   set cursor to busy
  2048.   push cd
  2049.   go cd 1 of this bg
  2050.   put empty into bookIndex
  2051.   put "Collecting book names" into status
  2052.   repeat with j = 1 to the number of cds in this bg
  2053.     showProgress status,round(j/(the number of cds in this bg)*100)
  2054.     repeat with i = 1 to (the number of lines in fld "appears in books field")
  2055.       set cursor to busy
  2056.       if line i of fld "appears in books field" = empty then next repeat
  2057.       if line i of fld "appears in books field" = return then next repeat
  2058.       if isFigNo(line i of fld "appears in books field") then next repeat
  2059.       if not isWithin(line i of fld "appears in books field",bookIndex)
  2060.       then
  2061.       put line i of fld "appears in books field" & return after bookIndex
  2062.     end if
  2063.   end repeat
  2064.   go next cd of this bg
  2065. end repeat
  2066. hideProgress
  2067. writeIndex bookIndex, "book index"
  2068. end collectBooks
  2069.  
  2070. on sortBookIndex
  2071.   put readIndex("book index") into bookIndex
  2072.   if bookIndex is empty then exit sortBookIndex
  2073.   set cursor to busy
  2074.   put 1 into i
  2075.   put "Sorting Book Index" into status
  2076.   repeat (the number of lines in bookIndex) times
  2077.     showProgress status,round(i/(the number of lines in bookIndex)*100)
  2078.     set cursor to busy
  2079.     if isEPN(line i of bookIndex) = true then
  2080.       put "^" after line (i-1) of bookIndex
  2081.       put line i of bookIndex after line (i-1) of bookIndex
  2082.       delete line i of bookIndex
  2083.     else add 1 to i
  2084.   end repeat
  2085.   hideProgress
  2086.   put sortContainer(bookIndex) into bookIndex
  2087.   put substitute("^", return,bookIndex) into bookIndex
  2088.   writeIndex bookIndex, "book index"
  2089. end sortBookIndex
  2090.  
  2091. on formatBookIndex
  2092.   put readIndex("book index") into bookIndex
  2093.   if bookIndex is empty then exit formatBookIndex
  2094.   set cursor to busy
  2095.   put 1 into i
  2096.   put "Formatting Book Index (deleting extra lines)" into status
  2097.   repeat (the number of lines in bookIndex) times
  2098.     showProgress status,round(i/(the number of lines in bookIndex)*100)
  2099.     set cursor to busy
  2100.     if line i of bookIndex = empty then
  2101.       delete line i of bookIndex
  2102.     else add 1 to i
  2103.   end repeat
  2104.   hideProgress
  2105.   put 1 into i
  2106.   put "Formatting Book Index (eng. part nos.)" into status
  2107.   repeat (the number of lines in bookIndex*2) times
  2108.     showProgress status,round(i/(the number of lines in bookIndex)*100)
  2109.     --if this line is an engineering part no.
  2110.     --then put a blank line after this line
  2111.     set cursor to busy
  2112.     if isEPN(line i of bookIndex) = true then
  2113.       put return & " " after line i of bookIndex
  2114.     end if
  2115.     add 1 to i
  2116.     if i = (the number of lines in bookIndex) then exit repeat
  2117.   end repeat
  2118.   hideProgress
  2119.   put 2 into i
  2120.   put "Formatting Book Index (books)" into status
  2121.   repeat (the number of lines in bookIndex*2) times
  2122.     showProgress status,round(i/(the number of lines in bookIndex)*100)
  2123.     --if this line is a book and it doesn't have an engineering part no
  2124.     --then put a blank line after this line
  2125.     set cursor to busy
  2126.     if isEPN(line i of bookIndex) = false AND line i of bookIndex <> " " then
  2127.       if isEPN(line i-1 of bookIndex) = false AND line (i-1) of bookIndex <> " " then
  2128.         put " " & return before line i of bookIndex
  2129.       end if
  2130.     end if
  2131.     if i = (the number of lines in bookIndex) then exit repeat
  2132.     add 1 to i
  2133.   end repeat
  2134.   hideProgress
  2135.   if the number of lines in bookIndex > 0 then
  2136.     repeat until last line of bookIndex <> empty
  2137.       delete last line of bookIndex
  2138.     end repeat
  2139.   end if
  2140.   writeIndex bookIndex, "book index"
  2141. end formatBookIndex
  2142.  
  2143. on deleteDeadLines
  2144.   put readIndex("book index") into bookIndex
  2145.   put 1 into i
  2146.   put "Formatting Book Index (extra lines)" into status
  2147.   repeat (the number of lines in bookIndex) times
  2148.     showProgress status,round(i/(the number of lines in bookIndex)*100)
  2149.     if line i of bookIndex = empty OR line i of bookIndex = space then
  2150.       delete line i of bookIndex
  2151.     else add 1 to i
  2152.   end repeat
  2153.   hideProgress
  2154.   writeIndex bookIndex, "book index"
  2155. end deleteDeadLines
  2156.  
  2157.  
  2158. -- part 282 (field)
  2159. -- low flags: 80
  2160. -- high flags: 2002
  2161. -- rect: left=15 top=84 right=267 bottom=226
  2162. -- title width / last selected line: 0
  2163. -- icon id / first selected line: 0 / 0
  2164. -- text alignment: 0
  2165. -- font id: 200
  2166. -- text size: 12
  2167. -- style flags: 0
  2168. -- line height: 16
  2169. -- part name: Banner
  2170.  
  2171.  
  2172. -- part 289 (button)
  2173. -- low flags: 00
  2174. -- high flags: A000
  2175. -- rect: left=239 top=222 right=239 bottom=333
  2176. -- title width / last selected line: 0
  2177. -- icon id / first selected line: 0 / 0
  2178. -- text alignment: 0
  2179. -- font id: 200
  2180. -- text size: 10
  2181. -- style flags: 0
  2182. -- line height: 13
  2183. -- part name: Appears in books:
  2184. ----- HyperTalk script -----
  2185. on mouseUp
  2186.   send findBook to bg btn "find‚Ķ"
  2187. end mouseUp
  2188.  
  2189.  
  2190.  
  2191. -- part 290 (field)
  2192. -- low flags: 01
  2193. -- high flags: 0007
  2194. -- rect: left=244 top=239 right=333 bottom=501
  2195. -- title width / last selected line: 0
  2196. -- icon id / first selected line: 0 / 0
  2197. -- text alignment: 0
  2198. -- font id: 200
  2199. -- text size: 10
  2200. -- style flags: 0
  2201. -- line height: 13
  2202. -- part name: appears in books field
  2203. ----- HyperTalk script -----
  2204. on mouseUp
  2205.   put line clickLine(the name of me) of me into whichText
  2206.   if whichText is empty then exit mouseUp
  2207.   set cursor to watch
  2208.   if isFigNo(whichText) then
  2209.     selectLine clickLine(the name of me), the short name of me
  2210.     answer "You can't search by the archive number."
  2211.     select empty
  2212.   else findBookSetup whichText
  2213. end mouseUp
  2214.  
  2215.  
  2216. -- part 298 (field)
  2217. -- low flags: 01
  2218. -- high flags: 0002
  2219. -- rect: left=308 top=62 right=77 bottom=501
  2220. -- title width / last selected line: 0
  2221. -- icon id / first selected line: 0 / 0
  2222. -- text alignment: 0
  2223. -- font id: 200
  2224. -- text size: 10
  2225. -- style flags: 0
  2226. -- line height: 13
  2227. -- part name: description field
  2228. ----- HyperTalk script -----
  2229. on mouseUp
  2230.   if the optionKey is up then
  2231.     put line 1 of me into whichText
  2232.     findNameSetup whichText
  2233.   else setMe
  2234. end mouseUp
  2235.  
  2236. on setMe
  2237.   lock screen
  2238.   if the style of me is "scrolling" then
  2239.     setSize (top of me + textHeight of me + 2)
  2240.     set the style of me to rectangle
  2241.   else
  2242.     setSize (the bottom of fld "appears in books field")
  2243.     set the style of me to scrolling
  2244.   end if
  2245. end setMe
  2246.  
  2247. on setSize whichSize
  2248.   get the rect of me
  2249.   put whichSize into item 4 of it
  2250.   set the rect of me to it
  2251. end setSize
  2252.  
  2253.  
  2254. -- part 299 (button)
  2255. -- low flags: 00
  2256. -- high flags: A002
  2257. -- rect: left=8 top=282 right=306 bottom=95
  2258. -- title width / last selected line: 0
  2259. -- icon id / first selected line: 0 / 0
  2260. -- text alignment: 1
  2261. -- font id: 200
  2262. -- text size: 12
  2263. -- style flags: 0
  2264. -- line height: 16
  2265. -- part name: Find…
  2266. ----- HyperTalk script -----
  2267. on mouseUp
  2268.   global DialogButton
  2269.   put "Find graphics by:" into text
  2270.   put "Description" & return & "File Name" & return & "File Format" & return & "Keyword" & return & "Book" & return & "Card number" into theList
  2271.   get listDialog(theList,13,text,true,"OK,Cancel")
  2272.   put it into theAnswer
  2273.   if DialogButton = "cancel" then exit mouseUp
  2274.   else if theAnswer = "description" then findName
  2275.   else if theAnswer = "file name" then findID
  2276.   else if theAnswer = "file format" then findFormat
  2277.   else if theAnswer = "keyword" then findKW
  2278.   else if theAnswer = "book" then findBook
  2279.   else if theAnswer = "card number" then findCdNumber
  2280. end mouseUp
  2281.  
  2282. on findKW
  2283.   global DialogButton
  2284.   put readIndex("keyword index") into theList
  2285.   put "Find graphics with what keyword?" into text
  2286.   get listDialog(theList,13,text,false,"OK,Cancel")
  2287.   unlock screen
  2288.   lock screen
  2289.   unlock screen
  2290.   if DialogButton <> "cancel" then findKWSetup it
  2291. end findKW
  2292.  
  2293. on findBook
  2294.   global DialogButton
  2295.   put readIndex("book index") into theList
  2296.   put "Find graphics from what book?" into text
  2297.   get listDialog(theList,13,text,false,"OK,Cancel")
  2298.   unlock screen
  2299.   lock screen
  2300.   unlock screen
  2301.   if it <> empty AND it <> space AND DialogButton <> "cancel" then
  2302.     findBookSetup it
  2303.   end if
  2304. end findBook
  2305.  
  2306. on findName
  2307.   global enterName
  2308.   unlock screen
  2309.   lock screen
  2310.   unlock screen
  2311.   ask "Find graphics with what description?" with enterName
  2312.   if it <> empty then
  2313.     put it into enterName
  2314.     findNameSetup enterName
  2315.   end if
  2316. end findName
  2317.  
  2318. on findFormat
  2319.   global enterFormat, DialogButton
  2320.   put "EPSF" & return & "MPNT" & return & "PICT" into theList
  2321.   put "Find graphics with what file format?" into text
  2322.   get listDialog(theList,13,text,false,"OK,Cancel")
  2323.   if DialogButton <> "cancel" then findFormatSetup it
  2324. end findFormat
  2325.  
  2326. on findID
  2327.   global idEntered
  2328.   ask "Find graphic with what file name:" with idEntered
  2329.   if it is empty then exit findID
  2330.   put it into idEntered
  2331.   set cursor to busy
  2332.   lock screen
  2333.   set lockMessages to true
  2334.   set lockRecent to true
  2335.   find idEntered in fld "file name field"
  2336.   if the foundChunk = empty then
  2337.     dialogIt "The file name "& quote & idEntered & quote && "is not assigned to any graphic."
  2338.   else
  2339.     openCard
  2340.     unlock screen with visual effect wipe left
  2341.   end if
  2342. end findID
  2343.  
  2344. on findCdNumber
  2345.   global cdNo
  2346.   unlock screen
  2347.   lock screen
  2348.   unlock screen
  2349.   ask "Find graphic with the card number:" with cdNo
  2350.   if it <> empty then
  2351.     put it into cdNo
  2352.     go cd cdNo of this bg
  2353.     if the result = empty then unlock screen with visual effect wipe left
  2354.     else
  2355.       dialogIt quote& cdNo "e&& "is not a card number for any graphic."
  2356.     end if
  2357.   end if
  2358. end findCdNumber
  2359.  
  2360.  
  2361.  
  2362. -- part 320 (button)
  2363. -- low flags: 80
  2364. -- high flags: C002
  2365. -- rect: left=15 top=62 right=84 bottom=226
  2366. -- title width / last selected line: 0
  2367. -- icon id / first selected line: 0 / 0
  2368. -- text alignment: 1
  2369. -- font id: 200
  2370. -- text size: 12
  2371. -- style flags: 0
  2372. -- line height: 16
  2373. -- part name: Help Section
  2374.  
  2375.  
  2376. -- part 319 (button)
  2377. -- low flags: 80
  2378. -- high flags: 0001
  2379. -- rect: left=19 top=65 right=81 bottom=37
  2380. -- title width / last selected line: 0
  2381. -- icon id / first selected line: 3071 / 3071
  2382. -- text alignment: 1
  2383. -- font id: 200
  2384. -- text size: 14
  2385. -- style flags: 0
  2386. -- line height: 18
  2387. -- part name: help close
  2388. ----- HyperTalk script -----
  2389. on mouseUp
  2390.   send cleanExit to bg btn "Help"
  2391. end mouseUp
  2392.  
  2393. on mouseDown
  2394.   set the icon of me to 3358
  2395. end mouseDown
  2396.  
  2397. on mouseLeave
  2398.   set the icon of me to 3071
  2399. end mouseLeave
  2400.  
  2401.  
  2402.  
  2403. -- part 321 (button)
  2404. -- low flags: 80
  2405. -- high flags: A002
  2406. -- rect: left=240 top=282 right=306 bottom=302
  2407. -- title width / last selected line: 0
  2408. -- icon id / first selected line: 0 / 0
  2409. -- text alignment: 1
  2410. -- font id: 200
  2411. -- text size: 12
  2412. -- style flags: 0
  2413. -- line height: 16
  2414. -- part name: New List
  2415. ----- HyperTalk script -----
  2416. on mouseUp
  2417.   global changesToList, activeListName, taggedList
  2418.   put the long name of this cd into returnHere
  2419.   saveChanges true
  2420.   set cursor to busy
  2421.   push cd
  2422.   lock screen
  2423.   goListStack "untitled"
  2424.   --Just to make sure that the list stack is there and it is unlocked.
  2425.   --If it's not, the user should know about it at this point, while
  2426.   --trying to create a new list.
  2427.   if the result = "no" then
  2428.     pop cd
  2429.     exit to hypercard
  2430.   end if
  2431.   go returnHere
  2432.   openCard
  2433.   put 0 into listScroll
  2434.   set the scroll of fld "list" to listScroll
  2435.   put false into changesToList
  2436.   put "Untitled" into activeListName
  2437.   showListName
  2438.   put empty into taggedList
  2439.   put taggedList into fld "list"
  2440. end mouseUp
  2441.  
  2442.  
  2443. -- part 322 (button)
  2444. -- low flags: 80
  2445. -- high flags: A002
  2446. -- rect: left=301 top=282 right=306 bottom=377
  2447. -- title width / last selected line: 0
  2448. -- icon id / first selected line: 0 / 0
  2449. -- text alignment: 1
  2450. -- font id: 200
  2451. -- text size: 12
  2452. -- style flags: 0
  2453. -- line height: 16
  2454. -- part name: Open List…
  2455. ----- HyperTalk script -----
  2456. on mouseUp
  2457.   global changesToList, taggedList, activeListName, listScroll
  2458.   put long name of this cd into returnHere
  2459.   if changesToList then saveChanges true
  2460.   set cursor to busy
  2461.   openAList returnHere
  2462.   put the result into selectedList
  2463.   if selectedList is empty then
  2464.     go returnHere
  2465.     openCard
  2466.     exit mouseUp
  2467.   end if
  2468.   set cursor to busy
  2469.   put selectedList into activeListName
  2470.   goListStack activeListName
  2471.   if the result = "no" then exit mouseUp
  2472.   put fld "tagged list" into taggedList
  2473.   go returnHere
  2474.   put taggedList into fld "list"
  2475.   put 0 into listScroll
  2476.   set scroll of fld "list" to listScroll
  2477.   showListName
  2478.   put false into changesToList
  2479.   openCard
  2480. end mouseUp
  2481.  
  2482. on openAList returnHere
  2483.   global activeListName, DialogButton
  2484.   -- build a list of the lists
  2485.   goListStack
  2486.   if the result = "no" then exit openAList
  2487.   go bg "lists"
  2488.   put empty into listNames
  2489.   repeat (the number of cds in this bg) times
  2490.     set cursor to busy
  2491.     if the short name of this cd <> "untitled" then
  2492.       put the short name of this cd & return after listNames
  2493.     end if
  2494.     go next cd of this bg
  2495.   end repeat
  2496.   put sortContainer(listNames) into theList
  2497.   put "Select a list to open:" into text
  2498.   go returnHere
  2499.   put listDialog(theList,13,text,false,"OK,Cancel") into theChoice
  2500.   if DialogButton = "cancel" then return empty
  2501.   else return theChoice
  2502. end openAList
  2503.  
  2504.  
  2505. -- part 323 (button)
  2506. -- low flags: 80
  2507. -- high flags: A002
  2508. -- rect: left=420 top=282 right=306 bottom=505
  2509. -- title width / last selected line: 0
  2510. -- icon id / first selected line: 0 / 0
  2511. -- text alignment: 1
  2512. -- font id: 200
  2513. -- text size: 12
  2514. -- style flags: 0
  2515. -- line height: 16
  2516. -- part name: Delete List…
  2517. ----- HyperTalk script -----
  2518. on mouseUp
  2519.   put the long name of this cd into returnHere
  2520.   put listsToDelete(returnHere) into deleteLists
  2521.   if deleteLists = empty then
  2522.     go returnHere
  2523.     openCard
  2524.     exit mouseUp
  2525.   end if
  2526.   goListStack (line 1 of deleteLists)
  2527.   if the result = "no" then
  2528.     go returnHere
  2529.     openCard
  2530.     exit mouseUp
  2531.   end if
  2532.   --You're in the list stack.
  2533.   repeat with i = 1 to the number of lines in deleteLists
  2534.     if the optionKey is up then
  2535.       dialogIt "Delete list "& quote & line i of deleteLists & quote & "?", "Cancel,OK"
  2536.       if the result is "cancel" then exit mouseUp
  2537.     end if
  2538.     go cd (line i of deleteLists)
  2539.     if the result <> empty then
  2540.       dialogIt "The list" && the short name of this cd && "was not found."
  2541.       next repeat
  2542.     end if
  2543.     doMenu "delete card"
  2544.   end repeat
  2545.   go returnHere
  2546.   openCard
  2547. end mouseUp
  2548.  
  2549. function listsToDelete returnHere
  2550. global activeListName, DialogButton
  2551. -- build a list of the lists
  2552. goListStack "untitled"
  2553. if the result = "no" then return empty
  2554. if the number of cds in this bg = 1 then
  2555.   answer "You can't delete the only list."
  2556.   exit listsToDelete
  2557. end if
  2558. put empty into listNames
  2559. repeat (the number of cds in this bg) times
  2560.   if the short name of this cd <> activeListName AND the short name of this cd <> "untitled" then
  2561.     put the short name of this cd & return after listNames
  2562.   end if
  2563.   go next cd of this bg
  2564. end repeat
  2565. put sortContainer(listNames) into theList
  2566. put "Select the list to delete:" into text
  2567. go returnHere
  2568. put listDialog(theList,13,text,true,"Delete,Cancel") into theChoice
  2569. if DialogButton = "cancel" then return empty
  2570. else return theChoice
  2571. end listsToDelete
  2572.  
  2573.  
  2574.  
  2575. -- part 324 (button)
  2576. -- low flags: 80
  2577. -- high flags: A002
  2578. -- rect: left=431 top=312 right=336 bottom=505
  2579. -- title width / last selected line: 0
  2580. -- icon id / first selected line: 0 / 0
  2581. -- text alignment: 1
  2582. -- font id: 200
  2583. -- text size: 12
  2584. -- style flags: 0
  2585. -- line height: 16
  2586. -- part name: Print List…
  2587. ----- HyperTalk script -----
  2588. on mouseUp
  2589.   global listScroll, activeListName
  2590.   put empty into savedUserLevel
  2591.   if the userLevel < 4 then
  2592.     put the userLevel into savedUserLevel
  2593.     set the userLevel to 4
  2594.   end if
  2595.   put the long name of this cd into returnHere
  2596.   put "Print the list" && quote & activeListName & quote && "with or without thumbnails?" into dialogText
  2597.   dialogIt dialogText,"Cancel,Without,With"
  2598.   put the result into it
  2599.   if it = "Cancel" then exit mouseUp
  2600.   if it = "With" then printWithThumbnails returnHere
  2601.   else printNoThumbnails returnHere
  2602.   go returnHere
  2603.   set the scroll of fld "list" to listScroll
  2604.   if savedUserLevel <> empty then set the userLevel to savedUserLevel
  2605.   openCard
  2606. end mouseUp
  2607.  
  2608. on printWithThumbnails returnHere
  2609.   global activeListName, taggedList, entryPrefix
  2610.   set cursor to busy
  2611.   put fld "list heading field" into headings
  2612.   goListStack "print TN/odd"
  2613.   if the result = "no" then
  2614.     go returnHere
  2615.     exit to hypercard
  2616.   end if
  2617.   put "LIST NAME:" into cd fld "title to print"
  2618.   put activeListName after cd fld "title to print"
  2619.   put headings into cd fld "headings"
  2620.   put taggedList into pTaggedList
  2621.   put "top" into reference
  2622.   put 1 into i
  2623.   open printing
  2624.   repeat (the number of lines in pTaggedList/2) times
  2625.     if reference = "top" then
  2626.       go cd "print TN/odd"
  2627.       put "bottom" into reference
  2628.     else
  2629.       go cd "print TN/even"
  2630.       put "top" into reference
  2631.     end if
  2632.     set cursor to busy
  2633.     put line i of pTaggedList into line 1 of cd fld "list"
  2634.     put line (i+1) of pTaggedList into line 2 of cd fld "list"
  2635.     put line (i+1) of pTaggedList into fileName
  2636.     delete char 1 to (the length of entryPrefix) of fileName
  2637.     push cd
  2638.     go returnHere
  2639.     find fileName in fld "file name field"
  2640.     if the foundChunk <> empty AND cardPictureExists() then
  2641.       copyThumbnail
  2642.       put true into pictureOnClipboard
  2643.     else put false into pictureOnClipboard
  2644.     pop cd
  2645.     if pictureOnClipboard then
  2646.       type "V" with commandKey
  2647.       drag from 118,107 to 123,170
  2648.       choose browse tool
  2649.     end if
  2650.     print this cd
  2651.     removeCdPict
  2652.     add 2 to i
  2653.   end repeat
  2654.   close printing
  2655. end printWithThumbnails
  2656.  
  2657. on printNoThumbnails
  2658.   global activeListName, taggedList
  2659.   lock screen
  2660.   set lockMessages to true
  2661.   set cursor to busy
  2662.   put fld "list heading field" into headings
  2663.   put taggedList into pTaggedList
  2664.   push cd
  2665.   goListStack "print w/out TN top"
  2666.   if the result = "no" then
  2667.     pop cd
  2668.     exit to hypercard
  2669.   end if
  2670.   put "LIST NAME:" into cd fld "title to print"
  2671.   put activeListName after cd fld "title to print"
  2672.   put headings into cd fld "headings"
  2673.   put linesVisible(the name of cd fld "list") into linesShowing
  2674.   put the number of lines in pTaggedList into numberOfLines
  2675.   put (the textHeight of cd fld "list") into pTextHeight
  2676.   put numberOfLines/pTextHeight into thisMany
  2677.   put trunc(thisMany) into thisMany
  2678.   put numberOfLines mod pTextHeight into remainder
  2679.   put abs(remainder) into remainder
  2680.   if remainder > 0 then add 1 to thisMany
  2681.   put "top" into reference
  2682.   open printing
  2683.   repeat thisMany times
  2684.     if reference = "top" then
  2685.       go cd "print w/out TN top"
  2686.       put "bottom" into reference
  2687.     else
  2688.       go cd "print w/out TN bottom"
  2689.       put "top" into reference
  2690.     end if
  2691.     set cursor to busy
  2692.     put pTaggedList into cd fld "list"
  2693.     set scroll of cd fld "list" to 0
  2694.     print this cd
  2695.     repeat with i = 1 to linesShowing
  2696.       delete line 1 of pTaggedList
  2697.     end repeat
  2698.   end repeat
  2699.   close printing
  2700. end printNoThumbnails
  2701.  
  2702.  
  2703.  
  2704. -- part 325 (button)
  2705. -- low flags: 80
  2706. -- high flags: A002
  2707. -- rect: left=376 top=282 right=306 bottom=421
  2708. -- title width / last selected line: 0
  2709. -- icon id / first selected line: 0 / 0
  2710. -- text alignment: 1
  2711. -- font id: 200
  2712. -- text size: 12
  2713. -- style flags: 0
  2714. -- line height: 16
  2715. -- part name: Save
  2716. ----- HyperTalk script -----
  2717. on mouseUp
  2718.   global changesToList, listScroll
  2719.   set cursor to busy
  2720.   put the scroll of fld "list" into listScroll
  2721.   put the long name of this cd into returnHere
  2722.   --changesToList = true if changes have been made to the list
  2723.   if changesToList then saveChanges false
  2724.   go returnHere
  2725.   set the scroll of fld "list" to listScroll
  2726.   openCard
  2727. end mouseUp
  2728.  
  2729.  
  2730. -- part 336 (button)
  2731. -- low flags: 80
  2732. -- high flags: A003
  2733. -- rect: left=17 top=246 right=270 bottom=226
  2734. -- title width / last selected line: 0
  2735. -- icon id / first selected line: 0 / 0
  2736. -- text alignment: 1
  2737. -- font id: 0
  2738. -- text size: 12
  2739. -- style flags: 0
  2740. -- line height: 16
  2741. -- part name: Click and Hold To Stop
  2742. ----- HyperTalk script -----
  2743. on mouseUp
  2744.   --you can click anywhere to stop the search - you don't have to click
  2745.   --this btn
  2746.   hide me
  2747. end mouseUp
  2748.  
  2749.  
  2750. -- part 10 (button)
  2751. -- low flags: 00
  2752. -- high flags: 4000
  2753. -- rect: left=196 top=313 right=335 bottom=214
  2754. -- title width / last selected line: 0
  2755. -- icon id / first selected line: 28600 / 28600
  2756. -- text alignment: 1
  2757. -- font id: 200
  2758. -- text size: 10
  2759. -- style flags: 0
  2760. -- line height: 13
  2761. -- part name: Next
  2762. ----- HyperTalk script -----
  2763. on mouseDown
  2764.   global ticksToWait
  2765.   if the commandKey is down then
  2766.     send setBrowseSpeed to bg btn "management"
  2767.     exit mouseDown
  2768.   end if
  2769.   set hilite of me to true
  2770.   go next cd of this bg
  2771.   repeat while the mouse is down
  2772.     put (the ticks + ticksToWait) into stopTicks
  2773.     repeat until stopTicks < (the ticks)
  2774.       if the mouse is up then
  2775.         set hilite of me to false
  2776.         exit mouseDown
  2777.       end if
  2778.     end repeat
  2779.     go next cd of this bg
  2780.   end repeat
  2781.   set hilite of me to false
  2782. end mouseDown
  2783.  
  2784.  
  2785. -- part 373 (field)
  2786. -- low flags: 81
  2787. -- high flags: 0000
  2788. -- rect: left=247 top=78 right=105 bottom=498
  2789. -- title width / last selected line: 0
  2790. -- icon id / first selected line: 0 / 0
  2791. -- text alignment: 0
  2792. -- font id: 4
  2793. -- text size: 9
  2794. -- style flags: 0
  2795. -- line height: 12
  2796. -- part name: List Heading Field
  2797.  
  2798.  
  2799. -- part 353 (button)
  2800. -- low flags: 80
  2801. -- high flags: 8002
  2802. -- rect: left=247 top=57 right=77 bottom=498
  2803. -- title width / last selected line: 0
  2804. -- icon id / first selected line: 0 / 0
  2805. -- text alignment: 1
  2806. -- font id: 0
  2807. -- text size: 12
  2808. -- style flags: 0
  2809. -- line height: 16
  2810. -- part name: List Name: Untitled
  2811. ----- HyperTalk script -----
  2812. on mouseUp
  2813.   global activeListName,taggedList,changesToList
  2814.   put the long name of this cd into returnHere
  2815.   set cursor to busy
  2816.   checkListName "Save the open list as:", activeListName
  2817.   if the result <> empty then
  2818.     go returnHere
  2819.     openCard
  2820.     exit mouseUp
  2821.   end if
  2822.   --The list name given is valid and is in the global activeListName.
  2823.   --You are in the list stack.
  2824.   put taggedList into fld "tagged list"
  2825.   put false into changesToList
  2826.   go returnHere
  2827.   showListName
  2828.   openCard
  2829. end mouseUp
  2830.  
  2831.  
  2832. -- part 376 (button)
  2833. -- low flags: 00
  2834. -- high flags: 8000
  2835. -- rect: left=241 top=29 right=49 bottom=411
  2836. -- title width / last selected line: 0
  2837. -- icon id / first selected line: 0 / 0
  2838. -- text alignment: 1
  2839. -- font id: 200
  2840. -- text size: 12
  2841. -- style flags: 0
  2842. -- line height: 16
  2843. -- part name: About This Graphic
  2844. ----- HyperTalk script -----
  2845. on mouseUp
  2846.   send mouseUp to bg btn "graphics view"
  2847. end mouseUp
  2848.  
  2849.  
  2850. -- part 377 (button)
  2851. -- low flags: 00
  2852. -- high flags: 8000
  2853. -- rect: left=412 top=29 right=49 bottom=504
  2854. -- title width / last selected line: 0
  2855. -- icon id / first selected line: 0 / 0
  2856. -- text alignment: 1
  2857. -- font id: 200
  2858. -- text size: 12
  2859. -- style flags: 0
  2860. -- line height: 16
  2861. -- part name: Lists
  2862. ----- HyperTalk script -----
  2863. on mouseUp
  2864.   send mouseUp to bg btn "lists view"
  2865. end mouseUp
  2866.  
  2867.  
  2868. -- part 312 (button)
  2869. -- low flags: 80
  2870. -- high flags: 8002
  2871. -- rect: left=240 top=312 right=336 bottom=350
  2872. -- title width / last selected line: 0
  2873. -- icon id / first selected line: 0 / 0
  2874. -- text alignment: 1
  2875. -- font id: 200
  2876. -- text size: 12
  2877. -- style flags: 0
  2878. -- line height: 16
  2879. -- part name: Add This Graphic
  2880. ----- HyperTalk script -----
  2881. on mouseUp
  2882.   global taggedList, entryPrefix, changesToList, entrySuffix
  2883.   set cursor to busy
  2884.   --Do this hiliting manually, since the user may have hit control-A
  2885.   --to activate this button
  2886.   --(See the background script handler "controlKey").
  2887.   set hilite of me to true
  2888.   set hilite of me to false
  2889.   --
  2890.   put true into changesToList
  2891.   put (the number of lines in fld "list" + 1) into lastLine
  2892.   put (lastLine / 2 + .5) into entryNo
  2893.   if entryNo >= 500 then
  2894.     dialogIt "Each list is limited to 500 entries." && "This graphic was not added to your list."
  2895.     exit mouseUp
  2896.   end if
  2897.   put beginEntryLine(entryNo) into beginLine
  2898.   lock screen
  2899.   put beginLine & entryNo & entrySuffix into line lastLine of fld "list"
  2900.   if line 1 of fld "description field" = empty then
  2901.     put "none" after line lastLine of fld "list"
  2902.   else
  2903.     put line 1 of fld "description field" after line lastLine of fld "list"
  2904.   end if
  2905.   put return & entryPrefix & fld "file name field" after line lastLine of fld "list"
  2906.   put fld "list" into taggedList
  2907.   setScroll (lastLine+1)
  2908. end mouseUp
  2909.  
  2910. on setScroll lastLine
  2911.   if lastLine > linesVisible(the name of fld "list") then
  2912.     repeat 2 times
  2913.       set scroll of fld "list" to (the scroll of fld "list" + the textHeight of fld "list")
  2914.     end repeat
  2915.   end if
  2916. end setScroll
  2917.  
  2918.  
  2919.  
  2920. -- part 313 (button)
  2921. -- low flags: 80
  2922. -- high flags: A002
  2923. -- rect: left=349 top=312 right=336 bottom=432
  2924. -- title width / last selected line: 0
  2925. -- icon id / first selected line: 0 / 0
  2926. -- text alignment: 1
  2927. -- font id: 200
  2928. -- text size: 12
  2929. -- style flags: 0
  2930. -- line height: 16
  2931. -- part name: Delete #…
  2932. ----- HyperTalk script -----
  2933. on mouseUp
  2934.   global taggedList,changesToList
  2935.   set cursor to arrow
  2936.   lock screen
  2937.   deleteEntryVisible true
  2938.   put the rect of fld "list" into listRect
  2939.   put listRect into validArea
  2940.   subtract 17 from item 3 of validArea
  2941.   --17 is the width of the scroll bar
  2942.   unlock screen with barn door open
  2943.   repeat
  2944.     wait while the mouse is up
  2945.     --the user clicked the mouse
  2946.     put the clickLoc into userLoc
  2947.     if userLoc is within the rect of fld "list" AND userLoc is not within validArea then
  2948.       --user clicked on the scroll bar
  2949.       next repeat
  2950.     end if
  2951.     if userLoc is not within validArea OR fld "list" = empty then
  2952.       deleteEntryVisible false
  2953.       exit repeat
  2954.     end if
  2955.     put clickLine(the name of fld "list") into whatLine
  2956.     if isEvenNumber(whatLine) then subtract 1 from whatLine
  2957.     repeat 2 times
  2958.       selectLine whatLine, "list"
  2959.       delete line whatLine of fld "list"
  2960.     end repeat
  2961.     reNumberSequence whatLine
  2962.     set cursor to arrow
  2963.   end repeat
  2964.   deleteEntryVisible false
  2965.   if fld "list" <> taggedList then
  2966.     --a change was made
  2967.     put fld "list" into taggedList
  2968.     put true into changesToList
  2969.   end if
  2970. end mouseUp
  2971.  
  2972. on reNumberSequence N
  2973.   --N is the line number of the first line that needs a new entry number
  2974.   global entryPrefix, entrySuffix
  2975.   repeat until line N of fld "list" = empty
  2976.     set cursor to watch
  2977.     delete char 1 to (the number of chars in entryPrefix) of line N of fld "list"
  2978.     put (N / 2 + .5) into newNumber
  2979.     put beginEntryLine(newNumber) into beginLine
  2980.     put beginLine & newNumber & entrySuffix before line N of fld "list"
  2981.     add 2 to N
  2982.   end repeat
  2983. end reNumberSequence
  2984.  
  2985.  
  2986. -- part 385 (button)
  2987. -- low flags: 00
  2988. -- high flags: A000
  2989. -- rect: left=239 top=62 right=77 bottom=309
  2990. -- title width / last selected line: 0
  2991. -- icon id / first selected line: 0 / 0
  2992. -- text alignment: 0
  2993. -- font id: 200
  2994. -- text size: 10
  2995. -- style flags: 0
  2996. -- line height: 13
  2997. -- part name: Description:
  2998. ----- HyperTalk script -----
  2999. on mouseUp
  3000.   send findName to bg btn "find‚Ķ"
  3001. end mouseUp
  3002.  
  3003.  
  3004.  
  3005. -- part 389 (field)
  3006. -- low flags: 81
  3007. -- high flags: 0002
  3008. -- rect: left=247 top=255 right=273 bottom=498
  3009. -- title width / last selected line: 0
  3010. -- icon id / first selected line: 0 / 0
  3011. -- text alignment: 0
  3012. -- font id: 200
  3013. -- text size: 10
  3014. -- style flags: 0
  3015. -- line height: 15
  3016. -- part name: directions to delete
  3017.  
  3018.  
  3019. -- part 387 (button)
  3020. -- low flags: 80
  3021. -- high flags: 8002
  3022. -- rect: left=447 top=257 right=271 bottom=496
  3023. -- title width / last selected line: 0
  3024. -- icon id / first selected line: 0 / 0
  3025. -- text alignment: 1
  3026. -- font id: 200
  3027. -- text size: 10
  3028. -- style flags: 0
  3029. -- line height: 13
  3030. -- part name: Done
  3031. ----- HyperTalk script -----
  3032. on mouseUp
  3033.   deleteEntryVisible false
  3034. end mouseUp
  3035.  
  3036.  
  3037. -- part 398 (button)
  3038. -- low flags: 80
  3039. -- high flags: 8004
  3040. -- rect: left=8 top=8 right=27 bottom=123
  3041. -- title width / last selected line: 0
  3042. -- icon id / first selected line: 0 / 0
  3043. -- text alignment: 1
  3044. -- font id: 0
  3045. -- text size: 12
  3046. -- style flags: 0
  3047. -- line height: 16
  3048. -- part name: Catalog
  3049. ----- HyperTalk script -----
  3050. on mouseDown
  3051.   global catalogMenu
  3052.   get menuPop(the name of me)
  3053.   put item 1 of it into menuT
  3054.   put item 2 of it into menuL
  3055.   get BigPop(catalogMenu,menuT,menuL)
  3056.   put it into theChoice
  3057.   if theChoice = 1 then catalogVolume
  3058.   if theChoice = 2 then catalogFolder
  3059.   if theChoice = 3 then catalogFile
  3060.   set the hilite of me to false
  3061. end mouseDown
  3062.  
  3063. on catalogVolume
  3064.   global DialogButton
  3065.   put "Catalog graphic files from which volume?" into text
  3066.   put listDialog(listVol(),13,text,false,"OK,Cancel") & ":" into volumeName
  3067.   if DialogButton = "cancel" then exit catalogVolume
  3068.   put listOurFiles(volumeName) into filesFound
  3069.   put listOurFiles("little geek:") into filesFound
  3070.   if filesFound = empty then noGraphicsFound
  3071.   else importGraphics filesFound
  3072. end catalogVolume
  3073.  
  3074. on catalogFolder
  3075.   put folderName("Select a folder to catalog:") into thisFolder
  3076.   if thisFolder = empty then exit catalogFolder
  3077.   put listOurFiles(thisFolder) into filesFound
  3078.   if filesFound = empty then noGraphicsFound
  3079.   else importGraphics filesFound
  3080. end catalogFolder
  3081.  
  3082. on catalogFile
  3083.   get getFileName("Catalog which file?")
  3084.   if it = empty then exit catalogFile
  3085.   importGraphics it
  3086. end catalogFile
  3087.  
  3088. on noGraphicsFound
  3089.   dialogIt "No graphic files were found."
  3090. end noGraphicsFound
  3091.  
  3092. on importGraphics listOfFiles
  3093.   set cursor to watch
  3094.   lock screen
  3095.   put empty into alreadyExists
  3096.   put empty into newGraphics
  3097.   go last cd of this bg
  3098.   put "Cataloguing files" into status
  3099.   repeat with i = 1 to the number of lines in listOfFiles
  3100.     showProgress status,round(i/(the number of lines in listOfFiles)*100)
  3101.     go bg "the collection"
  3102.     put getPath(line i of listOfFiles) into pathName
  3103.     put last item of line i of listOfFiles into fileType
  3104.     delete last item of line i of listOfFiles
  3105.     put line i of listOfFiles into longName
  3106.     put getShortName(longName) into fileName
  3107.     find whole fileName in fld "file name field"
  3108.     if the short name of this bg <> "the collection" then next repeat
  3109.     if fileName = fld "file name field" then
  3110.       --there is an exact match
  3111.       put fileName & return before newGraphics
  3112.       next repeat
  3113.     end if
  3114.     if (the short name of this cd <> the short name of first cd of this bg) OR (fld "file name field" <> empty) then
  3115.       go last cd of this bg
  3116.       doMenu "new card"
  3117.     end if
  3118.     setCdNo
  3119.     displayTiny longName
  3120.     if the result <> empty then
  3121.       --there was an error
  3122.       doMenu "delete card"
  3123.       next repeat
  3124.     end if
  3125.     put fileName into fld "file name field"
  3126.     put fileType into fld "format field"
  3127.     unlock screen       --since displayTiny locks the screen
  3128.     unlock screen       --since it was locked twice
  3129.     put fileName & return after newGraphics
  3130.     if not isWithin(pathName,cd fld "paths to graphics" of cd "title card")
  3131.     then
  3132.     put return & pathName after cd fld "paths to graphics" of cd "title card"
  3133.   end if
  3134.   lock screen
  3135. end repeat
  3136. checkDocuments
  3137. hideProgress
  3138. if alreadyExists <> empty then showExisting alreadyExists
  3139. if newGraphics = empty then dialogIt "There were no new file names."
  3140. else
  3141.   showNew newGraphics, "Cards were created for these file names."
  3142.   enterData newGraphics
  3143. end if
  3144. end importGraphics
  3145.  
  3146. on enterData newGraphics
  3147.   set cursor to busy
  3148.   toggleLockScreen
  3149.   put empty into prevName
  3150.   repeat with N = the number of lines in newGraphics down to 1
  3151.     find whole (line N of newGraphics) in fld "file name field"
  3152.     setCdNo
  3153.     put fld "file name field" into fileName
  3154.     if N = the number of lines in newGraphics then
  3155.       put the number of lines in newGraphics && "cards were added to the stck." into dialogText
  3156.     else
  3157.       if N = 1 then put "There is 1 card left." into dialogText
  3158.       else put "There are" && N && "cards left." into dialogText
  3159.     end if
  3160.     put " The current file name is" &"e& fileName "e& "." && "Do you want to enter information about this graphic?" after dialogText
  3161.     dialogIt dialogText,"No,Yes"
  3162.     if the result = "No" then exit repeat
  3163.     --Assign text to this card.
  3164.     assignToCard "keyword","keywords field","Keyword Index"
  3165.     toggleLockScreen
  3166.     send assignBook to bg btn "card"
  3167.     toggleLockScreen
  3168.     assignDescription prevName
  3169.     put the result into prevName
  3170.     toggleLockScreen
  3171.   end repeat
  3172.   openCard
  3173. end enterData
  3174.  
  3175. on assignDescription prevName
  3176.   put fld "file name field" into fileName
  3177.   ask "Enter a description for ""e& fileName "e& "." with prevName
  3178.   if it = empty then exit assignDescription
  3179.   put it into prevName
  3180.   put char 1 to 30 of prevName into fld "description field"
  3181.   if the length of prevName > 30 then
  3182.     put "‚Ķ" after fld "description field"
  3183.     put prevName into line 2 of fld "description field"
  3184.   end if
  3185.   return prevName
  3186. end assignDescription
  3187.